This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch ishan/upgrade-to-lucene-10
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/ishan/upgrade-to-lucene-10 by
this push:
new 20eb534e617 More improper ordinals handling
20eb534e617 is described below
commit 20eb534e61724b652c4a220f83396a21df408e88
Author: Ishan Chattopadhyaya <[email protected]>
AuthorDate: Wed Jan 22 23:26:32 2025 +0530
More improper ordinals handling
---
.../org/apache/solr/request/DocValuesFacets.java | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
b/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
index b1d3d82f57e..3fccf5a338f 100644
--- a/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
@@ -17,6 +17,7 @@
package org.apache.solr.request;
import java.io.IOException;
+import java.lang.invoke.MethodHandles;
import java.util.List;
import java.util.function.Predicate;
import org.apache.lucene.index.DocValues;
@@ -40,6 +41,8 @@ import org.apache.solr.search.DocSet;
import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.search.facet.FacetDebugInfo;
import org.apache.solr.util.LongPriorityQueue;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Computes term facets for docvalues field (single or multivalued).
@@ -415,7 +418,7 @@ public class DocValuesFacets {
int doc;
while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
if (si.advanceExact(doc)) {
- // strange do-while to collect the missing count (first ord is
NO_MORE_ORDS)
+ /*// strange do-while to collect the missing count (first ord is
NO_MORE_ORDS)
int term = (int) si.nextOrd();
do {
if (map != null) {
@@ -423,7 +426,17 @@ public class DocValuesFacets {
}
int arrIdx = term - startTermIndex;
if (arrIdx >= 0 && arrIdx < counts.length) counts[arrIdx]++;
- } while ((term = (int) si.nextOrd()) >= 0);
+ } while ((term = (int) si.nextOrd()) >= 0);*/
+ for (int o=0; o<si.docValueCount(); o++) {
+ long ord = si.nextOrd();
+ if (ord == DocIdSetIterator.NO_MORE_DOCS) break; // nocommit this
shouldn't have been needed, but without this the TestRandomDVFaceting is
failing. Why?
+ int term = (int) ord;
+ if (map != null) {
+ term = (int) ordMap.get(term);
+ }
+ int arrIdx = term - startTermIndex;
+ if (arrIdx >= 0 && arrIdx < counts.length) counts[arrIdx]++;
+ }
} else if (startTermIndex == -1) {
counts[0]++; // missing count
}
@@ -450,6 +463,7 @@ public class DocValuesFacets {
if (si.advanceExact(doc)) {
for (int o=0; o<si.docValueCount(); o++) {
long ord = si.nextOrd();
+ if (ord == DocIdSetIterator.NO_MORE_DOCS) break; // nocommit this
shouldn't have been needed, but without this the TestRandomDVFaceting is
failing. Why?
int term = (int) ord;
segCounts[1 + term]++;
}
@@ -464,6 +478,8 @@ public class DocValuesFacets {
}
}
+ private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
/** folds counts in segment ordinal space (segCounts) into global ordinal
space (counts) */
static void migrateGlobal(int counts[], int segCounts[], int subIndex,
OrdinalMap map) {
final LongValues ordMap = map.getGlobalOrds(subIndex);