djkevincr commented on a change in pull request #158: GORA-555: Improve Lucene 
query implementation with NumericRangeQuery
URL: https://github.com/apache/gora/pull/158#discussion_r272787990
 
 

 ##########
 File path: 
gora-lucene/src/main/java/org/apache/gora/lucene/query/LuceneQuery.java
 ##########
 @@ -51,22 +57,41 @@ public Query toLuceneQuery() {
     if (getKey() != null) {
       q = new TermQuery(new Term(pk, getKey().toString()));
     } else {
-      //TODO: Change this to a NumericRangeQuery when necessary (it's faster)
-      String lower = null;
-      String upper = null;
-      if (getStartKey() != null) {
-        //Do we need to escape the term?
-        lower = getStartKey().toString();
-      }
-      if (getEndKey() != null) {
-        upper = getEndKey().toString();
-      }
-      if (upper == null && lower == null) {
-        q = new MatchAllDocsQuery();
+      if (getEndKey() == null && getStartKey() == null) {
+        return new MatchAllDocsQuery();
       } else {
-        q = TermRangeQuery.newStringRange(pk, lower, upper, true, true);
+        q = inferType(pk, getStartKey(), getEndKey());
       }
     }
     return q;
   }
+
+  private <T> Query inferType(String pk, T lower, T upper) {
 
 Review comment:
   Don't you think it s more readable when we use Key type - K directly here as 
- 
   private Query inferType(String pk, K lower, K upper) {
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to