Apache Solr open-source search software
LUCENE-8104: Remove facet module compile-time dependency on queries
Alan Woodwardd9695cca5512
diff --git a/dev-tools/idea/lucene/facet/facet.iml b/dev-tools/idea/lucene/facet/facet.imlindex d5f93275707..43a8c790e6e 100644--- a/dev-tools/idea/lucene/facet/facet.iml+++ b/dev-tools/idea/lucene/facet/facet.iml@@ -24,8 +24,8 @@</orderEntry><orderEntry type="library" scope="TEST" name="JUnit" level="project" /><orderEntry type="module" scope="TEST" module-name="lucene-test-framework" />+ <orderEntry type="module" scope="TEST" module-name="queries" /><orderEntry type="module" module-name="analysis-common" />- <orderEntry type="module" module-name="queries" /><orderEntry type="module" module-name="lucene-core" /></component></module>diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 98cdcd9eeb9..f6a3cc73640 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -72,6 +72,9 @@ API ChangesUsers should instead use FunctionScoreQuery, possibly combined witha lucene expression (Alan Woodward)+* LUCENE-8104: Remove facets module compile-time dependency on queries+ (Alan Woodward)+New Features* LUCENE-2899: Add new module analysis/opennlp, with analysis componentsdiff --git a/lucene/facet/build.xml b/lucene/facet/build.xmlindex e91f1629802..2fc2f9a6ca8 100644--- a/lucene/facet/build.xml+++ b/lucene/facet/build.xml@@ -27,20 +27,15 @@<path id="classpath"><path refid="base.classpath"/>- <pathelement path="${queries.jar}"/><fileset dir="lib"/></path>- <target name="compile-core" depends="jar-queries,common.compile-core" />+ <path id="test.classpath">+ <pathelement path="${queries.jar}"/>+ <path refid="test.base.classpath"/>+ </path>- <target name="javadocs" depends="javadocs-queries,compile-core,check-javadocs-uptodate"- unless="javadocs-uptodate-${name}">- <invoke-module-javadoc>- <links>- <link href="../queries"/>- </links>- </invoke-module-javadoc>- </target>+ <target name="compile-core" depends="jar-queries,common.compile-core"/><target name="run-encoding-benchmark" depends="compile-test"><java classname="org.apache.lucene.util.encoding.EncodingSpeed" fork="true" failonerror="true">diff --git a/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.javaindex ac3f5b34a04..85fc6c54262 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java@@ -23,11 +23,9 @@ import java.util.Arrays;import java.util.Collections;import java.util.List;-import org.apache.lucene.facet.FacetResult;-import org.apache.lucene.facet.Facets;+import com.carrotsearch.hppc.LongIntScatterMap;+import com.carrotsearch.hppc.cursors.LongIntCursor;import org.apache.lucene.facet.FacetsCollector.MatchingDocs;-import org.apache.lucene.facet.FacetsCollector;-import org.apache.lucene.facet.LabelAndValue;import org.apache.lucene.index.DocValues;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.LeafReaderContext;@@ -40,9 +38,6 @@ import org.apache.lucene.search.LongValuesSource;import org.apache.lucene.util.InPlaceMergeSorter;import org.apache.lucene.util.PriorityQueue;-import com.carrotsearch.hppc.LongIntScatterMap;-import com.carrotsearch.hppc.cursors.LongIntCursor;-/** {@link Facets} implementation that computes counts for* all uniqute long values, more efficiently counting small values (0-1023) using an int array,@@ -72,14 +67,14 @@ public class LongValueFacetCounts extends Facets {}/** Create {@code LongValueFacetCounts}, using the provided- * {@link org.apache.lucene.queries.function.ValueSource}. If hits is+ * {@link LongValuesSource}. If hits is* null then all facets are counted. */public LongValueFacetCounts(String field, LongValuesSource valueSource, FacetsCollector hits) throws IOException {this(field, valueSource, hits, false);}/** Create {@code LongValueFacetCounts}, using the provided- * {@link org.apache.lucene.queries.function.ValueSource}.+ * {@link LongValuesSource}.* random access (implement {@link org.apache.lucene.search.DocIdSet#bits}). */public LongValueFacetCounts(String field, LongValuesSource valueSource, FacetsCollector hits,boolean multiValued) throws IOException {diff --git a/lucene/facet/src/java/org/apache/lucene/facet/range/LongRangeFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/range/LongRangeFacetCounts.javaindex 0bf9959f972..337f819590d 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/range/LongRangeFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/range/LongRangeFacetCounts.java@@ -24,7 +24,6 @@ import org.apache.lucene.facet.FacetsCollector;import org.apache.lucene.facet.FacetsCollector.MatchingDocs;import org.apache.lucene.index.IndexReaderContext;import org.apache.lucene.index.ReaderUtil;-import org.apache.lucene.queries.function.ValueSource;import org.apache.lucene.search.DocIdSet;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.IndexSearcher;@@ -53,13 +52,13 @@ public class LongRangeFacetCounts extends RangeFacetCounts {}/** Create {@code LongRangeFacetCounts}, using the provided- * {@link ValueSource}. */+ * {@link LongValuesSource}. */public LongRangeFacetCounts(String field, LongValuesSource valueSource, FacetsCollector hits, LongRange... ranges) throws IOException {this(field, valueSource, hits, null, ranges);}/** Create {@code LongRangeFacetCounts}, using the provided- * {@link ValueSource}, and using the provided Filter as+ * {@link LongValuesSource}, and using the provided Filter as* a fastmatch: only documents passing the filter are* checked for the matching ranges, which is helpful when* the provided {@link LongValuesSource} is costly per-document,diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacetSumValueSource.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacetSumValueSource.javaindex 6bc77c21a92..ccebd78bcf1 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacetSumValueSource.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacetSumValueSource.java@@ -22,14 +22,13 @@ import java.util.List;import org.apache.lucene.facet.FacetsCollector;import org.apache.lucene.facet.FacetsCollector.MatchingDocs;import org.apache.lucene.facet.FacetsConfig;-import org.apache.lucene.queries.function.FunctionValues;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.DoubleValues;import org.apache.lucene.search.DoubleValuesSource;import org.apache.lucene.util.IntsRef;/** Aggregates sum of values from {@link- * FunctionValues#doubleVal}, for each facet label.+ * DoubleValues#doubleValue()}, for each facet label.** @lucene.experimental */public class TaxonomyFacetSumValueSource extends FloatTaxonomyFacets {