mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
Allow fuzzy IP matches to accept a long min_similarity.
This commit is contained in:
parent
a7013da782
commit
112935fcdb
@ -178,7 +178,16 @@ public class IpFieldMapper extends NumberFieldMapper<Long> {
|
|||||||
|
|
||||||
@Override public Query fuzzyQuery(String value, String minSim, int prefixLength, int maxExpansions) {
|
@Override public Query fuzzyQuery(String value, String minSim, int prefixLength, int maxExpansions) {
|
||||||
long iValue = ipToLong(value);
|
long iValue = ipToLong(value);
|
||||||
long iSim = ipToLong(minSim);
|
long iSim;
|
||||||
|
try {
|
||||||
|
iSim = ipToLong(minSim);
|
||||||
|
} catch (ElasticSearchIllegalArgumentException e) {
|
||||||
|
try {
|
||||||
|
iSim = Long.parseLong(minSim);
|
||||||
|
} catch (NumberFormatException e1) {
|
||||||
|
iSim = (long) Double.parseDouble(minSim);
|
||||||
|
}
|
||||||
|
}
|
||||||
return NumericRangeQuery.newLongRange(names.indexName(), precisionStep,
|
return NumericRangeQuery.newLongRange(names.indexName(), precisionStep,
|
||||||
iValue - iSim,
|
iValue - iSim,
|
||||||
iValue + iSim,
|
iValue + iSim,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user