From d7f60388df9d70bfb4edcc30c86c94b7f7a9b407 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 22 Sep 2021 11:27:37 -0700 Subject: [PATCH] Fix split package in search business rules module (#78139) The CappedScore lucene query exists in search-business-rules, but split the lucene search package. This commit moves the implementation class into the existing module package name. --- .../plugin/search-business-rules/build.gradle | 7 ------- .../searchbusinessrules}/CappedScoreQuery.java | 18 +++++++++++++++++- .../CappedScoreWeight.java | 3 +-- .../searchbusinessrules}/CappedScorer.java | 6 +++++- .../PinnedQueryBuilder.java | 1 - .../PinnedQueryBuilderTests.java | 1 - 6 files changed, 23 insertions(+), 13 deletions(-) rename x-pack/plugin/search-business-rules/src/main/java/org/{apache/lucene/search => elasticsearch/xpack/searchbusinessrules}/CappedScoreQuery.java (90%) rename x-pack/plugin/search-business-rules/src/main/java/org/{apache/lucene/search => elasticsearch/xpack/searchbusinessrules}/CappedScoreWeight.java (96%) rename x-pack/plugin/search-business-rules/src/main/java/org/{apache/lucene/search => elasticsearch/xpack/searchbusinessrules}/CappedScorer.java (83%) diff --git a/x-pack/plugin/search-business-rules/build.gradle b/x-pack/plugin/search-business-rules/build.gradle index 3add3c939bb7e..31c83d675f3f8 100644 --- a/x-pack/plugin/search-business-rules/build.gradle +++ b/x-pack/plugin/search-business-rules/build.gradle @@ -14,10 +14,3 @@ dependencies { testImplementation(testArtifact(project(xpackModule('core')))) testImplementation project(":test:framework") } - -tasks.named('splitPackagesAudit').configure { - // Lucene classes should be owned by Lucene! - ignoreClasses 'org.apache.lucene.search.CappedScoreQuery', - 'org.apache.lucene.search.CappedScoreWeight', - 'org.apache.lucene.search.CappedScorer' -} diff --git a/x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreQuery.java b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScoreQuery.java similarity index 90% rename from x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreQuery.java rename to x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScoreQuery.java index 3f5de47c417d7..6f02d1c868cde 100644 --- a/x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreQuery.java +++ b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScoreQuery.java @@ -4,13 +4,29 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.apache.lucene.search; +package org.elasticsearch.xpack.searchbusinessrules; import java.io.IOException; import java.util.Objects; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.LeafReaderContext; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BoostQuery; +import org.apache.lucene.search.BulkScorer; +import org.apache.lucene.search.DocIdSetIterator; +import org.apache.lucene.search.FilterLeafCollector; +import org.apache.lucene.search.FilterScorable; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.LeafCollector; +import org.apache.lucene.search.Matches; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.QueryVisitor; +import org.apache.lucene.search.Scorable; +import org.apache.lucene.search.ScoreMode; +import org.apache.lucene.search.Scorer; +import org.apache.lucene.search.ScorerSupplier; +import org.apache.lucene.search.Weight; import org.apache.lucene.util.Bits; /** diff --git a/x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreWeight.java b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScoreWeight.java similarity index 96% rename from x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreWeight.java rename to x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScoreWeight.java index 42790a4f68b8e..aed361fa11626 100644 --- a/x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreWeight.java +++ b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScoreWeight.java @@ -5,10 +5,9 @@ * 2.0. */ -package org.apache.lucene.search; +package org.elasticsearch.xpack.searchbusinessrules; import org.apache.lucene.index.LeafReaderContext; -import org.apache.lucene.index.Term; import java.io.IOException; import java.util.Set; diff --git a/x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScorer.java b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScorer.java similarity index 83% rename from x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScorer.java rename to x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScorer.java index 523d11ee7958e..57b2b62b77f6d 100644 --- a/x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScorer.java +++ b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/CappedScorer.java @@ -5,7 +5,11 @@ * 2.0. */ -package org.apache.lucene.search; +package org.elasticsearch.xpack.searchbusinessrules; + +import org.apache.lucene.search.FilterScorer; +import org.apache.lucene.search.Scorer; +import org.apache.lucene.search.Weight; import java.io.IOException; diff --git a/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java index a296fb0684354..165be122a148d 100644 --- a/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java +++ b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.searchbusinessrules; import org.apache.lucene.search.BoostQuery; -import org.apache.lucene.search.CappedScoreQuery; import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.DisjunctionMaxQuery; import org.apache.lucene.search.MatchNoDocsQuery; diff --git a/x-pack/plugin/search-business-rules/src/test/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilderTests.java b/x-pack/plugin/search-business-rules/src/test/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilderTests.java index 5d00758c16abc..b9df0eea2b16e 100644 --- a/x-pack/plugin/search-business-rules/src/test/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilderTests.java +++ b/x-pack/plugin/search-business-rules/src/test/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilderTests.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.core.io.JsonStringEncoder; -import org.apache.lucene.search.CappedScoreQuery; import org.apache.lucene.search.DisjunctionMaxQuery; import org.apache.lucene.search.Query; import org.elasticsearch.common.ParsingException;