From e063aaf97f6fe049134b210143af944e63f770be Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 19 Sep 2016 11:01:39 +0200 Subject: [PATCH] enable fuzzy search, solr style (append a ~ to get a fuzzyness on the word) --- source/net/yacy/search/query/QueryGoal.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/search/query/QueryGoal.java b/source/net/yacy/search/query/QueryGoal.java index c23b7e170..fb4eff8da 100644 --- a/source/net/yacy/search/query/QueryGoal.java +++ b/source/net/yacy/search/query/QueryGoal.java @@ -416,12 +416,12 @@ public class QueryGoal { for (String s: include_strings) { if (Segment.catchallString.equals(s)) continue; if (wc > 0) w.append(" AND "); - w.append(dq).append(s).append(dq); + if (s.indexOf('~') >= 0 || s.indexOf('*') >= 0 || s.indexOf('?') >= 0) w.append(s); else w.append(dq).append(s).append(dq); wc++; } for (String s: exclude_strings){ if (wc > 0) w.append(" AND -"); - w.append(dq).append(s).append(dq); + if (s.indexOf('~') >= 0 || s.indexOf('*') >= 0 || s.indexOf('?') >= 0) w.append(s); else w.append(dq).append(s).append(dq); wc++; } if (wc > 1) {w.insert(0, '('); w.append(')');}