Skip to content
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

Change default value to true for transpositions parameter of fuzzy query #26901

Merged
merged 2 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class FuzzyQueryBuilder extends AbstractQueryBuilder<FuzzyQueryBuilder> i
public static final int DEFAULT_MAX_EXPANSIONS = FuzzyQuery.defaultMaxExpansions;

/** Default as to whether transpositions should be treated as a primitive edit operation,
* instead of classic Levenshtein algorithm. Defaults to false. */
public static final boolean DEFAULT_TRANSPOSITIONS = false;
* instead of classic Levenshtein algorithm. Defaults to true. */
public static final boolean DEFAULT_TRANSPOSITIONS = FuzzyQuery.defaultTranspositions;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a small test in FuzzyQueryBuilderTests that setting transpositions to true/false works ?
You can also remove the comment below:

//LUCENE 4 UPGRADE ...

private static final ParseField TERM_FIELD = new ParseField("term");
private static final ParseField VALUE_FIELD = new ParseField("value");
Expand Down
6 changes: 5 additions & 1 deletion docs/reference/migration/migrate_7_0/search.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[[breaking_70_search_changes]]
=== Search changes
=== Search and Query DSL changes

==== Changes to queries
* The default value for `transpositions` parameter of `fuzzy` query
has been changed to `true`.

==== Adaptive replica selection enabled by default

Expand Down
5 changes: 3 additions & 2 deletions docs/reference/query-dsl/fuzzy-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ GET /_search
"boost" : 1.0,
"fuzziness" : 2,
"prefix_length" : 0,
"max_expansions": 100
"max_expansions": 100,
"transpositions": false
}
}
}
Expand Down Expand Up @@ -66,7 +67,7 @@ GET /_search
`transpositions`::

Whether fuzzy transpositions (`ab` -> `ba`) are supported.
Default is `false`.
Default is `true`.

WARNING: This query can be very heavy if `prefix_length` is set to `0` and if
`max_expansions` is set to a high number. It could result in every term in the
Expand Down