cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Minor update to LuceneQueryVisitor to convert Strings to lower case if the analyzer indexed with the lower case too
Date Mon, 18 Aug 2014 11:51:59 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes e024aa72e -> 345ccc219


Minor update to LuceneQueryVisitor to convert Strings to lower case if the analyzer indexed
with the lower case too


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/345ccc21
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/345ccc21
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/345ccc21

Branch: refs/heads/3.0.x-fixes
Commit: 345ccc2198303421a9e1428bd96632e4b8a2ff23
Parents: e024aa7
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon Aug 18 11:15:44 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon Aug 18 12:51:39 2014 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/ext/search/lucene/LuceneQueryVisitor.java      | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/345ccc21/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/lucene/LuceneQueryVisitor.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/lucene/LuceneQueryVisitor.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/lucene/LuceneQueryVisitor.java
index 11de05e..3383730 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/lucene/LuceneQueryVisitor.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/lucene/LuceneQueryVisitor.java
@@ -48,6 +48,7 @@ public class LuceneQueryVisitor<T> extends AbstractSearchConditionVisitor<T,
Que
 
     private String contentsFieldName;
     private Map<String, String> contentsFieldMap;
+    private boolean caseInsensitiveMatch;
     private Stack<List<Query>> queryStack = new Stack<List<Query>>();
     public LuceneQueryVisitor() {
         this(Collections.<String, String>emptyMap());        
@@ -139,6 +140,9 @@ public class LuceneQueryVisitor<T> extends AbstractSearchConditionVisitor<T,
Que
         Query query = null;
         if (cls == String.class) {
             String strValue = value.toString();
+            if (caseInsensitiveMatch) {
+                strValue = strValue.toLowerCase();
+            }
             boolean isWildCard = strValue.contains("*") || super.isWildcardStringMatch();

             
             String theContentsFieldName = getContentsFieldName(name);
@@ -267,5 +271,9 @@ public class LuceneQueryVisitor<T> extends AbstractSearchConditionVisitor<T,
Que
         }
         
         return booleanQuery;
+    }
+
+    public void setCaseInsensitiveMatch(boolean caseInsensitiveMatch) {
+        this.caseInsensitiveMatch = caseInsensitiveMatch;
     }    
 }


Mime
View raw message