Skip to content

Commit b851787

Browse files
authored
fix(query): similarQuery not accounted for in param string (#654)
1 parent 9e2a7ee commit b851787

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/scala/algolia/objects/Query.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ case class Query(
210210
/* Search */
211211
"query" -> query,
212212
"facetQuery" -> facetQuery,
213+
"similarQuery" -> similarQuery,
213214
/* Typos */
214215
"minWordSizefor1Typo" -> minWordSizefor1Typo.map(_.toString),
215216
"minWordSizefor2Typos" -> minWordSizefor2Typos.map(_.toString),

src/test/scala/algolia/dsl/SearchTest.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,18 @@ class SearchTest extends AlgoliaTest {
272272
}
273273
}
274274

275+
describe("search with similarQuery") {
276+
it("should parametrize stuff") {
277+
val q = Query(
278+
query = Some(""),
279+
similarQuery = Some("\"test phrase\""),
280+
advancedSyntax = Some(true),
281+
advancedSyntaxFeatures = Some(Seq("exactPhrase"))
282+
)
283+
284+
q.toParam should be(
285+
"advancedSyntax=true&query=&advancedSyntaxFeatures=exactPhrase&similarQuery=%22test+phrase%22"
286+
)
287+
}
288+
}
275289
}

0 commit comments

Comments
 (0)