mike-tr-adamson commented on code in PR #2916:
URL: https://github.com/apache/cassandra/pull/2916#discussion_r1403257342


##########
src/java/org/apache/cassandra/index/sai/plan/QueryController.java:
##########
@@ -133,22 +133,16 @@ public List<DataRange> dataRanges()
         return ranges;
     }
 
-    /**
-     * @return indexed {@code IndexContext} if index is found; otherwise 
return non-indexed {@code IndexContext}.
-     */
-    public IndexContext getContext(RowFilter.Expression expression)
+    public StorageAttachedIndex indexFor(RowFilter.Expression expression)
     {
         Set<StorageAttachedIndex> indexes = 
cfs.indexManager.getBestIndexFor(expression, StorageAttachedIndex.class);
+        return indexes.isEmpty() ? null : indexes.iterator().next();
+    }
 
-        return indexes.isEmpty() ? new IndexContext(cfs.getKeyspaceName(),
-                                                    cfs.getTableName(),
-                                                    
cfs.metadata().partitionKeyType,
-                                                    cfs.getPartitioner(),
-                                                    cfs.getComparator(),
-                                                    expression.column(),
-                                                    IndexTarget.Type.VALUES,
-                                                    null)
-                                 : indexes.iterator().next().getIndexContext();
+    public AbstractAnalyzer analyzerFor(RowFilter.Expression expression)
+    {
+        StorageAttachedIndex index = indexFor(expression);
+        return index == null ? new NoOpAnalyzer() : index.analyzer();

Review Comment:
   I agree. I've been debating this because I don't like the extra code for the 
noop analyzer. As it stands all string handling goes through the analyzer path, 
where a good number probably don't use an analyzer even on indexed strings.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to