-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(dsl): Support Fuzzy query #347
Conversation
* the ability to find results that are similar to, but not exactly the same as, the search term or query | ||
* | ||
* @param value | ||
* the [[String]] value to represent the 'fuzziness' field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* the [[String]] value to represent the 'fuzziness' field | |
* the text value to represent the 'fuzziness' field |
* @param value | ||
* the [[String]] value to represent the 'fuzziness' field | ||
* @return | ||
* a new instance of the [[zio.elasticsearch.query.ElasticQuery]] with the `fuzziness` value set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* a new instance of the [[zio.elasticsearch.query.ElasticQuery]] with the `fuzziness` value set. | |
* an instance of the [[zio.elasticsearch.query.ElasticQuery]] enriched with the `fuzziness` parameter. |
|
||
/** | ||
* Sets the `fuzziness` parameter for this [[zio.elasticsearch.query.ElasticQuery]]. The `fuzziness` value refers to | ||
* the ability to find results that are similar to, but not exactly the same as, the search term or query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* the ability to find results that are similar to, but not exactly the same as, the search term or query | |
* the ability to find results that are similar to, but not exactly the same as, the search term or query. |
|
||
/** | ||
* Sets the `maxExpansions` parameter for this [[zio.elasticsearch.query.ElasticQuery]]. The `maxExpansions` value | ||
* defines the maximum number of terms the fuzzy query will match before halting the search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* defines the maximum number of terms the fuzzy query will match before halting the search | |
* defines the maximum number of terms the fuzzy query will match before halting the search. |
* defines the maximum number of terms the fuzzy query will match before halting the search | ||
* | ||
* @param value | ||
* the whole number value for `maxExpansions` parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* the whole number value for `maxExpansions` parameter | |
* the positive whole number value for `maxExpansions` parameter |
* refers to the number of beginning characters left unchanged when creating expansions | ||
* | ||
* @param value | ||
* the whole number value for `prefixLength` parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* the whole number value for `prefixLength` parameter | |
* the positive whole number value for `prefixLength` parameter |
* @param value | ||
* the whole number value for `prefixLength` parameter | ||
* @return | ||
* a new instance of the [[zio.elasticsearch.query.ElasticQuery]] with the `prefixLength` value set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -1010,6 +1010,29 @@ object HttpExecutorSpec extends IntegrationSpec { | |||
Executor.execute(ElasticRequest.createIndex(firstSearchIndex)), | |||
Executor.execute(ElasticRequest.deleteIndex(firstSearchIndex)).orDie | |||
), | |||
test("search for a document which changes a character using a fuzzy query") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rephrase this test text?
@@ -582,6 +582,81 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
) | |||
) | |||
}, | |||
test("fuzzy") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one test for all parameters together.
@@ -2189,6 +2264,79 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
assert(queryTs.toJson(fieldPath = None))(equalTo(expectedTs.toJson)) && | |||
assert(queryTsWithBoost.toJson(fieldPath = None))(equalTo(expectedTsWithBoost.toJson)) | |||
}, | |||
test("fuzzy") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also.
title: "Fuzzy Query" | ||
--- | ||
|
||
The `Fuzzy` query returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a link to this Levenshtein edit distance.
https://en.wikipedia.org/wiki/Levenshtein_distance
@@ -588,7 +588,9 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
val queryWithCaseFuzzinessAuto = fuzzy(TestDocument.stringField, "test").fuzziness("AUTO") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omit Case
.
@@ -588,7 +588,9 @@ object ElasticQuerySpec extends ZIOSpecDefault { | |||
val queryWithCaseFuzzinessAuto = fuzzy(TestDocument.stringField, "test").fuzziness("AUTO") | |||
val queryWithCaseMaxExpansions = fuzzy(TestDocument.stringField, "test").maxExpansions(50) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also.
Part of #91