-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MB-19243: Detect fuzziness automatically based on term length (#2060)
- The following queries can now automatically detect fuzziness based on the length of the terms: - Match Query - Fuzzy Query - Match-Phrase Query - Multi-Phrase Query - Phrase Query - In these queries, each term (whether in a multi-term query like Match or Phrase, or in a single-term query like Fuzzy can have its own edit distance based on its length. The edit distance is calculated as follows: - For terms with 1 or 2 characters: edit distance = 0 (exact match) - For terms with 3, 4, or 5 characters: edit distance = 1 (fuzzy match) - For terms with more than 5 characters: edit distance = 2 (fuzzy match) - This feature can be enabled using the `<query>.SetAutoFuzziness(<bool>)` API. - Additionally, we've extended the functionality to query JSON parsing. You can specify fuzziness as either "auto" or a static value in the JSON query. Both formats are valid: 1. With auto fuzziness: ``` { "match" : "lorem", "field" : "bleve" "fuzziness" : "auto" } ``` 2. With static fuzziness: ``` { "match" : "lorem", "field" : "bleve" "fuzziness" : 2 } ``` When unmarshalled, the query will correctly apply the chosen fuzziness method. - Fixed a bug where the code incorrectly returned an error message saying `fuzziness exceeds maximum` when using a fuzzy searcher with `fuzziness = 0`. Instead, a term searcher is now returned in this case.
- Loading branch information
1 parent
d002624
commit 3a21667
Showing
9 changed files
with
514 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.