aruggero commented on code in PR #3433:
URL: https://github.com/apache/solr/pull/3433#discussion_r2235405884


##########
solr/modules/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java:
##########
@@ -551,16 +554,117 @@ public DocIdSetIterator iterator() {
         return featureTraversalScorer.iterator();
       }
 
-      private class SparseModelScorer extends Scorer {
-        private final DisiPriorityQueue subScorers;
-        private final ScoringQuerySparseIterator itr;
+      public void setIsLogging(boolean isLogging) {
+        this.isLogging = isLogging;
+      }
 
-        private int targetDoc = -1;
-        private int activeDoc = -1;
+      abstract class FeatureTraversalScorer extends Scorer {
+        protected int targetDoc = -1;
+        protected int activeDoc = -1;
+        protected LeafReaderContext leafContext;
 
-        private SparseModelScorer(
-            Weight weight, List<Feature.FeatureWeight.FeatureScorer> 
featureScorers) {
+        protected FeatureTraversalScorer(Weight weight, LeafReaderContext 
leafContext) {
           super(weight);
+          this.leafContext = leafContext;
+        }
+
+        @Override
+        public float score() throws IOException {
+          reset();
+          fillFeaturesInfo();
+          return makeNormalizedFeaturesAndScore();
+        }
+
+        @Override
+        public float getMaxScore(int upTo) throws IOException {
+          return Float.POSITIVE_INFINITY;
+        }
+
+        private void fillFeaturesInfo() throws IOException {
+          if (activeDoc == targetDoc) {
+            SolrCache<Integer, float[]> featureVectorCache = null;
+            float[] featureVector;
+
+            // Check added otherwise 
org.apache.solr.ltr.TestLTRScoringQuery.testLTRScoringQuery
+            // and 
org.apache.solr.ltr.TestSelectiveWeightCreation.testScoringQueryWeightCreation
+            // fail

Review Comment:
   I don't know if it exists a scenario where the request could be null. In my 
first implementation, this check (request != null) was not present.
   After executing tests, I noticed that for the ones listed in the comment, 
the request is null; therefore, it is not possible to get the cache, and the 
code is raising an error...
   I wasn't able to modify the test in order to populate the request.



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to