Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dbulaja98 committed Feb 8, 2023
1 parent 55ab052 commit a5a2a98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ object ElasticQuery {
def filter(queries: ElasticQuery[_]*): BoolQuery =
self.copy(filter = filter ++ queries)

def must(queries: ElasticQuery[_]*): BoolQuery =
self.copy(must = must ++ queries)

def paramsToJson: Json = Obj(
"bool" -> Obj(
"filter" -> Arr(filter.map(_.toJson): _*),
Expand All @@ -137,9 +140,6 @@ object ElasticQuery {
)
)

def must(queries: ElasticQuery[_]*): BoolQuery =
self.copy(must = must ++ queries)

def should(queries: ElasticQuery[_]*): BoolQuery =
self.copy(should = should ++ queries)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object QueryDSLSpec extends ZIOSpecDefault {
val (id, name, address, balance, age) = schema.makeAccessors(ElasticQueryAccessorBuilder)
}

def spec: Spec[Environment with TestEnvironment with Scope, Any] =
override def spec: Spec[Environment with TestEnvironment with Scope, Any] =
suite("Query DSL")(
suite("creating ElasticQuery")(
test("successfully create Match query using `matches` method") {
Expand Down Expand Up @@ -195,7 +195,7 @@ object QueryDSLSpec extends ZIOSpecDefault {
test("successfully create MatchAll Query") {
val query = matchAll

assert(query)(equalTo(MatchAllQuery(boost = None)))
assert(query)(equalTo(MatchAllQuery(None)))
},
test("successfully create MatchAll Query with boost") {
val query = matchAll.boost(1.0)
Expand Down Expand Up @@ -474,7 +474,7 @@ object QueryDSLSpec extends ZIOSpecDefault {
|}
|""".stripMargin

assert(query.toJsonBody)(equalTo(expected.toJson))
assert(query.toJson)(equalTo(expected.toJson))
},
test("properly encode Bool Query with Must containing `Match` leaf query") {
val query = boolQuery.must(matches(field = "day_of_week", value = "Monday"))
Expand Down

0 comments on commit a5a2a98

Please sign in to comment.