diff --git a/src/main/java/com/yelp/nrtsearch/server/config/ThreadPoolConfiguration.java b/src/main/java/com/yelp/nrtsearch/server/config/ThreadPoolConfiguration.java index 634a29f0c..458e47d19 100644 --- a/src/main/java/com/yelp/nrtsearch/server/config/ThreadPoolConfiguration.java +++ b/src/main/java/com/yelp/nrtsearch/server/config/ThreadPoolConfiguration.java @@ -16,8 +16,8 @@ package com.yelp.nrtsearch.server.config; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import com.yelp.nrtsearch.server.utils.JsonUtils; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; import java.util.HashMap; import java.util.Map; @@ -56,7 +56,7 @@ public class ThreadPoolConfiguration { Math.max(100, 2 * DEFAULT_VECTOR_MERGE_THREADS); /** - * Settings for a {@link com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory.ExecutorType}. + * Settings for a {@link ThreadPoolExecutorFactory.ExecutorType}. * * @param maxThreads max number of threads * @param maxBufferedItems max number of buffered items diff --git a/src/main/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplier.java b/src/main/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplier.java index a2d0f3c43..46f0cdffd 100644 --- a/src/main/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplier.java +++ b/src/main/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplier.java @@ -15,7 +15,7 @@ */ package com.yelp.nrtsearch.server.grpc; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import io.grpc.Metadata; import io.grpc.ServerCall; import io.grpc.ServerCallExecutorSupplier; diff --git a/src/main/java/com/yelp/nrtsearch/server/grpc/LuceneServer.java b/src/main/java/com/yelp/nrtsearch/server/grpc/LuceneServer.java index 88f1a73d0..5eb364507 100644 --- a/src/main/java/com/yelp/nrtsearch/server/grpc/LuceneServer.java +++ b/src/main/java/com/yelp/nrtsearch/server/grpc/LuceneServer.java @@ -25,18 +25,17 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.util.JsonFormat; -import com.yelp.nrtsearch.LuceneServerModule; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.config.QueryCacheConfig; import com.yelp.nrtsearch.server.luceneserver.AddReplicaHandler; import com.yelp.nrtsearch.server.luceneserver.CopyFilesHandler; import com.yelp.nrtsearch.server.luceneserver.GetNodesInfoHandler; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.NewNRTPointHandler; import com.yelp.nrtsearch.server.luceneserver.RecvCopyStateHandler; import com.yelp.nrtsearch.server.luceneserver.ReplicaCurrentSearchingVersionHandler; import com.yelp.nrtsearch.server.luceneserver.WriteNRTPointHandler; import com.yelp.nrtsearch.server.luceneserver.analysis.AnalyzerCreator; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import com.yelp.nrtsearch.server.luceneserver.custom.request.CustomRequestProcessor; import com.yelp.nrtsearch.server.luceneserver.field.FieldDefCreator; import com.yelp.nrtsearch.server.luceneserver.handler.AddDocumentHandler; @@ -75,6 +74,9 @@ import com.yelp.nrtsearch.server.luceneserver.handler.StopIndexHandler; import com.yelp.nrtsearch.server.luceneserver.handler.UpdateFieldsHandler; import com.yelp.nrtsearch.server.luceneserver.highlights.HighlighterService; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.index.handlers.LiveSettingsV2Handler; import com.yelp.nrtsearch.server.luceneserver.index.handlers.SettingsV2Handler; import com.yelp.nrtsearch.server.luceneserver.logging.HitsLoggerCreator; @@ -84,6 +86,8 @@ import com.yelp.nrtsearch.server.luceneserver.search.cache.NrtQueryCache; import com.yelp.nrtsearch.server.luceneserver.search.collectors.CollectorCreator; import com.yelp.nrtsearch.server.luceneserver.similarity.SimilarityCreator; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; +import com.yelp.nrtsearch.server.modules.LuceneServerModule; import com.yelp.nrtsearch.server.monitoring.Configuration; import com.yelp.nrtsearch.server.monitoring.DeadlineMetrics; import com.yelp.nrtsearch.server.monitoring.DirSizeCollector; @@ -99,7 +103,6 @@ import com.yelp.nrtsearch.server.plugins.Plugin; import com.yelp.nrtsearch.server.plugins.PluginsService; import com.yelp.nrtsearch.server.remote.RemoteBackend; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; import com.yelp.nrtsearch.tools.cli.VersionProvider; import io.grpc.Server; import io.grpc.ServerBuilder; diff --git a/src/main/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClient.java b/src/main/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClient.java index a5b2db768..0ae1accd2 100644 --- a/src/main/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClient.java +++ b/src/main/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClient.java @@ -20,7 +20,7 @@ import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.grpc.ReplicationServerGrpc.ReplicationServerBlockingStub; import com.yelp.nrtsearch.server.grpc.discovery.PrimaryFileNameResolverProvider; -import com.yelp.nrtsearch.server.luceneserver.SimpleCopyJob.FileChunkStreamingIterator; +import com.yelp.nrtsearch.server.luceneserver.nrt.SimpleCopyJob.FileChunkStreamingIterator; import io.grpc.Deadline; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/AddReplicaHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/AddReplicaHandler.java index a25152e70..cf0dce051 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/AddReplicaHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/AddReplicaHandler.java @@ -18,6 +18,8 @@ import com.yelp.nrtsearch.server.grpc.AddReplicaRequest; import com.yelp.nrtsearch.server.grpc.AddReplicaResponse; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.handler.Handler; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import io.grpc.Status; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/CopyFilesHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/CopyFilesHandler.java index 802df6a91..1390d8ccc 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/CopyFilesHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/CopyFilesHandler.java @@ -18,6 +18,9 @@ import com.yelp.nrtsearch.server.grpc.CopyFiles; import com.yelp.nrtsearch.server.grpc.TransferStatus; import com.yelp.nrtsearch.server.grpc.TransferStatusCode; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTReplicaNode; import com.yelp.nrtsearch.server.luceneserver.handler.Handler; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import com.yelp.nrtsearch.server.monitoring.NrtMetrics; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/GetNodesInfoHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/GetNodesInfoHandler.java index 7d0bd520e..f031157e7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/GetNodesInfoHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/GetNodesInfoHandler.java @@ -19,6 +19,9 @@ import com.yelp.nrtsearch.server.grpc.GetNodesResponse; import com.yelp.nrtsearch.server.grpc.NodeInfo; import com.yelp.nrtsearch.server.luceneserver.handler.Handler; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTPrimaryNode; import com.yelp.nrtsearch.server.utils.HostPort; import io.grpc.Status; import io.grpc.stub.StreamObserver; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/IndexBackupUtils.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/IndexBackupUtils.java deleted file mode 100644 index c9ea75c03..000000000 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/IndexBackupUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 Yelp Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yelp.nrtsearch.server.luceneserver; - -import com.yelp.nrtsearch.server.luceneserver.state.backend.RemoteStateBackend; - -public class IndexBackupUtils { - public static final String INDEX_STATE_SUFFIX = "-state"; - - public static String getResourceMetadata(String resourceName) { - return String.format("%s_metadata", resourceName); - } - - public static String getResourceData(String resourceName) { - return String.format("%s_data", resourceName); - } - - public static String getResourceVersionMetadata(String resourceName) { - return String.format("_version/%s_metadata", resourceName); - } - - public static String getResourceVersionData(String resourceName) { - return String.format("_version/%s_data", resourceName); - } - - public static boolean isMetadata(String resourceName) { - return resourceName.endsWith("_metadata"); - } - - public static boolean isBackendGlobalState(String resourceName) { - return RemoteStateBackend.GLOBAL_STATE_RESOURCE.equals(resourceName); - } - - /** Get if this resource applies for index state. */ - public static boolean isIndexState(String resourceName) { - return resourceName.endsWith(INDEX_STATE_SUFFIX); - } -} diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/NewNRTPointHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/NewNRTPointHandler.java index 17f9ae2ee..05052b575 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/NewNRTPointHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/NewNRTPointHandler.java @@ -23,6 +23,8 @@ import io.grpc.Status; import io.grpc.StatusRuntimeException; import io.grpc.stub.StreamObserver; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/RecvCopyStateHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/RecvCopyStateHandler.java index 2cdba0e61..391a7c5db 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/RecvCopyStateHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/RecvCopyStateHandler.java @@ -25,6 +25,9 @@ import io.grpc.Status; import io.grpc.StatusRuntimeException; import io.grpc.stub.StreamObserver; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTPrimaryNode; import java.io.IOException; import java.util.Map; import org.apache.lucene.replicator.nrt.FileMetaData; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/ReplicaCurrentSearchingVersionHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/ReplicaCurrentSearchingVersionHandler.java index 16e1fb014..f60b7827b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/ReplicaCurrentSearchingVersionHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/ReplicaCurrentSearchingVersionHandler.java @@ -20,6 +20,8 @@ import com.yelp.nrtsearch.server.luceneserver.handler.Handler; import io.grpc.Status; import io.grpc.stub.StreamObserver; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/StartIndexHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/StartIndexHandler.java index ecabad669..1eced8040 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/StartIndexHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/StartIndexHandler.java @@ -22,7 +22,9 @@ import com.yelp.nrtsearch.server.grpc.StartIndexRequest; import com.yelp.nrtsearch.server.grpc.StartIndexResponse; import com.yelp.nrtsearch.server.luceneserver.handler.Handler.HandlerException; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; import com.yelp.nrtsearch.server.remote.RemoteBackend; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/WriteNRTPointHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/WriteNRTPointHandler.java index ff8286c00..5e01fd332 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/WriteNRTPointHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/WriteNRTPointHandler.java @@ -20,12 +20,15 @@ import com.yelp.nrtsearch.server.grpc.SearcherVersion; import com.yelp.nrtsearch.server.luceneserver.handler.Handler; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTPrimaryNode; import io.grpc.Status; import io.grpc.StatusRuntimeException; import io.grpc.stub.StreamObserver; import java.io.IOException; +import java.util.Collection; import java.util.Iterator; -import java.util.Queue; import org.apache.lucene.facet.taxonomy.SearcherTaxonomyManager; import org.apache.lucene.index.DirectoryReader; import org.slf4j.Logger; @@ -81,8 +84,8 @@ private SearcherVersion handle(IndexState indexState, String indexId) { // before notifying all replicas, at which point we have a newer version index than client // knew about? long version = shardState.nrtPrimaryNode.getCopyStateVersion(); - Queue replicasInfos = - shardState.nrtPrimaryNode.replicasInfos; + Collection replicasInfos = + shardState.nrtPrimaryNode.getNodesInfo(); shardState.nrtPrimaryNode.message( "send flushed version=" + version + " replica count " + replicasInfos.size()); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/ServerCodec.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/codec/ServerCodec.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/ServerCodec.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/codec/ServerCodec.java index 7a50cfff5..75ce11a66 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/ServerCodec.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/codec/ServerCodec.java @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.codec; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.VectorFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.DocValuesFormat; diff --git a/src/main/java/com/yelp/nrtsearch/server/utils/ThreadPoolExecutorFactory.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/concurrent/ThreadPoolExecutorFactory.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/utils/ThreadPoolExecutorFactory.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/concurrent/ThreadPoolExecutorFactory.java index f250107d4..b81c2aee3 100644 --- a/src/main/java/com/yelp/nrtsearch/server/utils/ThreadPoolExecutorFactory.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/concurrent/ThreadPoolExecutorFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.utils; +package com.yelp.nrtsearch.server.luceneserver.concurrent; import com.yelp.nrtsearch.server.config.ThreadPoolConfiguration; import com.yelp.nrtsearch.server.monitoring.ThreadPoolCollector; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/LoadedDocValues.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/LoadedDocValues.java index 57277421f..4b21d1b39 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/LoadedDocValues.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/LoadedDocValues.java @@ -26,6 +26,8 @@ import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.FieldValue.Vector; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.FieldValue.Vector.Builder; import com.yelp.nrtsearch.server.luceneserver.geo.GeoPoint; +import com.yelp.nrtsearch.server.luceneserver.vector.ByteVectorType; +import com.yelp.nrtsearch.server.luceneserver.vector.FloatVectorType; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; @@ -951,9 +953,9 @@ public int size() { } } - public static final class SingleVector extends LoadedDocValues { + public static final class SingleVector extends LoadedDocValues { private final BinaryDocValues docValues; - private VectorType value; + private FloatVectorType value; public SingleVector(BinaryDocValues docValues) { this.docValues = docValues; @@ -972,18 +974,18 @@ public void setDocId(int docID) throws IOException { } /** Decodes binary doc value to float array and wraps it into a VectorType */ - private static VectorType decodeBytesRefToVectorType(BytesRef bytesRef) { + private static FloatVectorType decodeBytesRefToVectorType(BytesRef bytesRef) { float[] floats = new float[bytesRef.length / Float.BYTES]; FloatBuffer fb = ByteBuffer.wrap(bytesRef.bytes, bytesRef.offset, bytesRef.length).asFloatBuffer(); fb.get(floats); - return new VectorType(floats); + return new FloatVectorType(floats); } /** Provide field value containing the doc value data for a given index */ @Override public FieldValue toFieldValue(int index) { - VectorType vector = get(index); + FloatVectorType vector = get(index); Builder vectorBuilder = Vector.newBuilder(); for (float value : vector.getVectorData()) { vectorBuilder.addValue(value); @@ -994,7 +996,7 @@ public FieldValue toFieldValue(int index) { } @Override - public VectorType get(int index) { + public FloatVectorType get(int index) { if (value == null) { throw new IllegalStateException("No doc values for document"); } else if (index != 0) { @@ -1008,7 +1010,7 @@ public int size() { return value == null ? 0 : 1; } - public VectorType getValue() { + public FloatVectorType getValue() { return get(0); } } @@ -1071,9 +1073,9 @@ public ByteVectorType getValue() { * Doc value interface for vector data loaded from index vector values indexed for vector search. * Calls to {@link #setDocId(int)} must provide ids in increasing order. */ - public static final class SingleSearchVector extends LoadedDocValues { + public static final class SingleSearchVector extends LoadedDocValues { private final FloatVectorValues vectorValues; - private VectorType value = null; + private FloatVectorType value = null; public SingleSearchVector(FloatVectorValues vectorValues) { this.vectorValues = vectorValues; @@ -1086,7 +1088,7 @@ public void setDocId(int docID) throws IOException { vectorValues.advance(docID); } if (vectorValues.docID() == docID) { - value = new VectorType(vectorValues.vectorValue()); + value = new FloatVectorType(vectorValues.vectorValue()); } else { value = null; } @@ -1095,7 +1097,7 @@ public void setDocId(int docID) throws IOException { @Override public FieldValue toFieldValue(int index) { - VectorType vector = get(index); + FloatVectorType vector = get(index); Builder vectorBuilder = Vector.newBuilder(); for (float value : vector.getVectorData()) { vectorBuilder.addValue(value); @@ -1106,7 +1108,7 @@ public FieldValue toFieldValue(int index) { } @Override - public VectorType get(int index) { + public FloatVectorType get(int index) { if (value == null) { throw new IllegalStateException("No doc values for document"); } else if (index != 0) { @@ -1120,7 +1122,7 @@ public int size() { return value == null ? 0 : 1; } - public VectorType getValue() { + public FloatVectorType getValue() { return get(0); } } diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/DrillSidewaysImpl.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/DrillSidewaysImpl.java index 9a54300d8..c2033efe7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/DrillSidewaysImpl.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/DrillSidewaysImpl.java @@ -19,8 +19,6 @@ import com.yelp.nrtsearch.server.grpc.Facet; import com.yelp.nrtsearch.server.grpc.NumericRangeType; import com.yelp.nrtsearch.server.grpc.SearchResponse.Diagnostics; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.field.DoubleFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; @@ -30,6 +28,8 @@ import com.yelp.nrtsearch.server.luceneserver.field.LongFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.RuntimeFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.VirtualFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.script.FacetScript; import com.yelp.nrtsearch.server.luceneserver.script.ScriptService; import com.yelp.nrtsearch.server.utils.ScriptParamsUtils; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/FacetTopDocs.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/FacetTopDocs.java index b8baad059..a6abe7709 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/FacetTopDocs.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/facet/FacetTopDocs.java @@ -18,10 +18,10 @@ import com.yelp.nrtsearch.server.grpc.Facet; import com.yelp.nrtsearch.server.grpc.FacetResult; import com.yelp.nrtsearch.server.grpc.SearchResponse.Diagnostics; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ContextSuggestFieldDef.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ContextSuggestFieldDef.java index 652992ed6..68ee69ae0 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ContextSuggestFieldDef.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ContextSuggestFieldDef.java @@ -19,7 +19,7 @@ import com.google.gson.GsonBuilder; import com.yelp.nrtsearch.server.grpc.Field; import com.yelp.nrtsearch.server.luceneserver.analysis.AnalyzerCreator; -import com.yelp.nrtsearch.server.luceneserver.suggest.protocol.ContextSuggestFieldData; +import com.yelp.nrtsearch.server.luceneserver.suggest.ContextSuggestFieldData; import java.util.List; import java.util.Optional; import org.apache.lucene.analysis.Analyzer; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/IndexableFieldDef.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/IndexableFieldDef.java index 75c58474a..3b7f29633 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/IndexableFieldDef.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/IndexableFieldDef.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.Field; import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.handler.AddDocumentHandler; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.similarity.SimilarityCreator; import com.yelp.nrtsearch.server.utils.StructValueTransformer; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ObjectFieldDef.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ObjectFieldDef.java index 79bba9a04..bed84202f 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ObjectFieldDef.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/ObjectFieldDef.java @@ -24,9 +24,9 @@ import com.google.protobuf.util.JsonFormat; import com.yelp.nrtsearch.server.grpc.Field; import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.handler.AddDocumentHandler; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import java.io.IOException; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/VectorFieldDef.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/VectorFieldDef.java index 5f9aab7d9..782a8ec7a 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/VectorFieldDef.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/field/VectorFieldDef.java @@ -20,15 +20,15 @@ import com.yelp.nrtsearch.server.grpc.Field; import com.yelp.nrtsearch.server.grpc.KnnQuery; import com.yelp.nrtsearch.server.grpc.VectorIndexingOptions; -import com.yelp.nrtsearch.server.luceneserver.doc.ByteVectorType; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues.SingleSearchVector; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues.SingleVector; -import com.yelp.nrtsearch.server.luceneserver.doc.VectorType; import com.yelp.nrtsearch.server.luceneserver.field.properties.VectorQueryable; -import com.yelp.nrtsearch.server.luceneserver.search.query.vector.NrtKnnByteVectorQuery; -import com.yelp.nrtsearch.server.luceneserver.search.query.vector.NrtKnnFloatVectorQuery; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; +import com.yelp.nrtsearch.server.luceneserver.query.vector.NrtKnnByteVectorQuery; +import com.yelp.nrtsearch.server.luceneserver.query.vector.NrtKnnFloatVectorQuery; +import com.yelp.nrtsearch.server.luceneserver.vector.ByteVectorType; +import com.yelp.nrtsearch.server.luceneserver.vector.FloatVectorType; import java.io.IOException; import java.nio.ByteBuffer; import java.util.List; @@ -322,13 +322,14 @@ public Query getKnnQuery(KnnQuery knnQuery, Query filterQuery) { } /** Field class for 'FLOAT' vector field type. */ - public static class FloatVectorFieldDef extends VectorFieldDef { + public static class FloatVectorFieldDef extends VectorFieldDef { public FloatVectorFieldDef(String name, Field requestField) { - super(name, requestField, VectorType.class); + super(name, requestField, FloatVectorType.class); } @Override - public LoadedDocValues getDocValues(LeafReaderContext context) throws IOException { + public LoadedDocValues getDocValues(LeafReaderContext context) + throws IOException { if (docValuesType == DocValuesType.BINARY) { BinaryDocValues binaryDocValues = DocValues.getBinary(context.reader(), getName()); return new SingleVector(binaryDocValues); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/AddDocumentHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/AddDocumentHandler.java index bcbafdedb..5570c96f5 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/AddDocumentHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/AddDocumentHandler.java @@ -22,12 +22,12 @@ import com.yelp.nrtsearch.server.grpc.AddDocumentResponse; import com.yelp.nrtsearch.server.grpc.DeadlineUtils; import com.yelp.nrtsearch.server.grpc.FacetHierarchyPath; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IdFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Context; import io.grpc.Status; import io.grpc.stub.StreamObserver; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/BackupWarmingQueriesHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/BackupWarmingQueriesHandler.java index 40f8485f6..0bd08d666 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/BackupWarmingQueriesHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/BackupWarmingQueriesHandler.java @@ -17,8 +17,8 @@ import com.yelp.nrtsearch.server.grpc.BackupWarmingQueriesRequest; import com.yelp.nrtsearch.server.grpc.BackupWarmingQueriesResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.warming.Warmer; import io.grpc.Status; import io.grpc.stub.StreamObserver; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CommitHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CommitHandler.java index 63c172ac0..fbdd2b5c7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CommitHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CommitHandler.java @@ -17,8 +17,8 @@ import com.yelp.nrtsearch.server.grpc.CommitRequest; import com.yelp.nrtsearch.server.grpc.CommitResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Context; import io.grpc.Status; import io.grpc.StatusRuntimeException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateIndexHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateIndexHandler.java index 953693a8d..2214a7eda 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateIndexHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateIndexHandler.java @@ -17,7 +17,7 @@ import com.yelp.nrtsearch.server.grpc.CreateIndexRequest; import com.yelp.nrtsearch.server.grpc.CreateIndexResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import org.slf4j.Logger; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateSnapshotHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateSnapshotHandler.java index c817fe7fb..1d83eebea 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateSnapshotHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CreateSnapshotHandler.java @@ -19,9 +19,9 @@ import com.yelp.nrtsearch.server.grpc.CreateSnapshotRequest; import com.yelp.nrtsearch.server.grpc.CreateSnapshotResponse; import com.yelp.nrtsearch.server.grpc.SnapshotId; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CustomHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CustomHandler.java index d625d1c7f..362bfddff 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CustomHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/CustomHandler.java @@ -17,8 +17,8 @@ import com.yelp.nrtsearch.server.grpc.CustomRequest; import com.yelp.nrtsearch.server.grpc.CustomResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.custom.request.CustomRequestProcessor; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import org.slf4j.Logger; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteAllDocumentsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteAllDocumentsHandler.java index a07717002..84ed1c55b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteAllDocumentsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteAllDocumentsHandler.java @@ -16,9 +16,9 @@ package com.yelp.nrtsearch.server.luceneserver.handler; import com.yelp.nrtsearch.server.grpc.*; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteByQueryHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteByQueryHandler.java index 053156685..f5e9b74c5 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteByQueryHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteByQueryHandler.java @@ -17,10 +17,10 @@ import com.yelp.nrtsearch.server.grpc.AddDocumentResponse; import com.yelp.nrtsearch.server.grpc.DeleteByQueryRequest; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteDocumentsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteDocumentsHandler.java index ff2c530ce..3291b634b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteDocumentsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteDocumentsHandler.java @@ -18,9 +18,9 @@ import com.google.protobuf.ProtocolStringList; import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.AddDocumentResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteIndexHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteIndexHandler.java index 9658fed62..a8a95426e 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteIndexHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/DeleteIndexHandler.java @@ -17,8 +17,8 @@ import com.yelp.nrtsearch.server.grpc.DeleteIndexRequest; import com.yelp.nrtsearch.server.grpc.DeleteIndexResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeDeletesHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeDeletesHandler.java index 246b8caec..d4afc768d 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeDeletesHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeDeletesHandler.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.ForceMergeDeletesRequest; import com.yelp.nrtsearch.server.grpc.ForceMergeDeletesResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeHandler.java index 062a7e3bf..4ec06ed74 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ForceMergeHandler.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.ForceMergeRequest; import com.yelp.nrtsearch.server.grpc.ForceMergeResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetAllSnapshotIndexGenHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetAllSnapshotIndexGenHandler.java index 5101a444b..e422f2768 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetAllSnapshotIndexGenHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetAllSnapshotIndexGenHandler.java @@ -17,7 +17,7 @@ import com.yelp.nrtsearch.server.grpc.GetAllSnapshotGenRequest; import com.yelp.nrtsearch.server.grpc.GetAllSnapshotGenResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.stub.StreamObserver; import java.io.IOException; import java.util.Set; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetStateHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetStateHandler.java index ad4075237..15d8b3db7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetStateHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GetStateHandler.java @@ -18,8 +18,8 @@ import com.google.gson.JsonObject; import com.yelp.nrtsearch.server.grpc.StateRequest; import com.yelp.nrtsearch.server.grpc.StateResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GlobalStateHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GlobalStateHandler.java index 28a999484..72399db64 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GlobalStateHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/GlobalStateHandler.java @@ -17,7 +17,7 @@ import com.yelp.nrtsearch.server.grpc.GlobalStateRequest; import com.yelp.nrtsearch.server.grpc.GlobalStateResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import org.slf4j.Logger; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/Handler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/Handler.java index d84c435c9..14b883895 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/Handler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/Handler.java @@ -19,8 +19,8 @@ import com.google.protobuf.GeneratedMessageV3; import com.yelp.nrtsearch.server.grpc.LuceneServerStubBuilder; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import io.grpc.Status; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.stub.ServerCallStreamObserver; import io.grpc.stub.StreamObserver; import org.slf4j.Logger; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/IndicesHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/IndicesHandler.java index 2d75747fe..4b9e51b50 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/IndicesHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/IndicesHandler.java @@ -19,8 +19,8 @@ import com.yelp.nrtsearch.server.grpc.IndicesRequest; import com.yelp.nrtsearch.server.grpc.IndicesResponse; import com.yelp.nrtsearch.server.grpc.StatsResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/LiveSettingsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/LiveSettingsHandler.java index 23c8bd542..2a1e26df1 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/LiveSettingsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/LiveSettingsHandler.java @@ -21,9 +21,9 @@ import com.yelp.nrtsearch.server.grpc.IndexLiveSettings; import com.yelp.nrtsearch.server.grpc.LiveSettingsRequest; import com.yelp.nrtsearch.server.grpc.LiveSettingsResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReadyHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReadyHandler.java index 180665944..e289396a7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReadyHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReadyHandler.java @@ -20,8 +20,8 @@ import com.yelp.nrtsearch.server.grpc.HealthCheckResponse; import com.yelp.nrtsearch.server.grpc.ReadyCheckRequest; import com.yelp.nrtsearch.server.grpc.TransferStatusCode; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.util.ArrayList; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RefreshHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RefreshHandler.java index c8bd6507b..4863f4856 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RefreshHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RefreshHandler.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.RefreshRequest; import com.yelp.nrtsearch.server.grpc.RefreshResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RegisterFieldsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RegisterFieldsHandler.java index 6ebe0c946..1413560b7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RegisterFieldsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/RegisterFieldsHandler.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.FieldDefRequest; import com.yelp.nrtsearch.server.grpc.FieldDefResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import com.yelp.nrtsearch.server.luceneserver.index.handlers.FieldUpdateHandler; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReleaseSnapshotHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReleaseSnapshotHandler.java index 71f2bc463..ba283c823 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReleaseSnapshotHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReleaseSnapshotHandler.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.ReleaseSnapshotRequest; import com.yelp.nrtsearch.server.grpc.ReleaseSnapshotResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReloadStateHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReloadStateHandler.java index 9c2466a63..446bbc6b6 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReloadStateHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/ReloadStateHandler.java @@ -18,7 +18,7 @@ import com.yelp.nrtsearch.server.grpc.Mode; import com.yelp.nrtsearch.server.grpc.ReloadStateRequest; import com.yelp.nrtsearch.server.grpc.ReloadStateResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import org.slf4j.Logger; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchHandler.java index 748030bf4..e72f09535 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchHandler.java @@ -29,10 +29,6 @@ import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.FieldValue; import com.yelp.nrtsearch.server.grpc.SearchResponse.SearchState; import com.yelp.nrtsearch.server.grpc.TotalHits; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.MyIndexSearcher; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.facet.DrillSidewaysImpl; import com.yelp.nrtsearch.server.luceneserver.facet.FacetTopDocs; @@ -42,14 +38,18 @@ import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.RuntimeFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.VirtualFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.innerhit.InnerHitFetchTask; import com.yelp.nrtsearch.server.luceneserver.rescore.RescoreTask; import com.yelp.nrtsearch.server.luceneserver.script.RuntimeScript; import com.yelp.nrtsearch.server.luceneserver.search.FieldFetchContext; +import com.yelp.nrtsearch.server.luceneserver.search.MyIndexSearcher; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; import com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper.CollectionTimeoutException; import com.yelp.nrtsearch.server.luceneserver.search.SearchRequestProcessor; import com.yelp.nrtsearch.server.luceneserver.search.SearcherResult; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.monitoring.SearchResponseCollector; import com.yelp.nrtsearch.server.utils.ObjectToCompositeFieldTransformer; import com.yelp.nrtsearch.server.utils.ProtoMessagePrinter; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchV2Handler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchV2Handler.java index 8b18dc00a..090c3aab7 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchV2Handler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SearchV2Handler.java @@ -20,7 +20,7 @@ import com.google.protobuf.util.JsonFormat.Printer; import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.utils.ProtoMessagePrinter; import io.grpc.Status; import io.grpc.StatusRuntimeException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SettingsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SettingsHandler.java index 9a8120919..950ffc229 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SettingsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/SettingsHandler.java @@ -23,9 +23,9 @@ import com.yelp.nrtsearch.server.grpc.IndexSettings; import com.yelp.nrtsearch.server.grpc.SettingsRequest; import com.yelp.nrtsearch.server.grpc.SettingsResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexHandler.java index 81707e663..0538ddef6 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexHandler.java @@ -17,7 +17,7 @@ import com.yelp.nrtsearch.server.grpc.StartIndexRequest; import com.yelp.nrtsearch.server.grpc.StartIndexResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexV2Handler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexV2Handler.java index 0eb80873f..8f0031687 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexV2Handler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StartIndexV2Handler.java @@ -17,7 +17,7 @@ import com.yelp.nrtsearch.server.grpc.StartIndexResponse; import com.yelp.nrtsearch.server.grpc.StartIndexV2Request; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StatsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StatsHandler.java index a53dc7f0f..1f8a9e367 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StatsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StatsHandler.java @@ -19,9 +19,9 @@ import com.yelp.nrtsearch.server.grpc.StatsRequest; import com.yelp.nrtsearch.server.grpc.StatsResponse; import com.yelp.nrtsearch.server.grpc.Taxonomy; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StopIndexHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StopIndexHandler.java index 5aa670ed1..f77af96d9 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StopIndexHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/StopIndexHandler.java @@ -17,7 +17,7 @@ import com.yelp.nrtsearch.server.grpc.DummyResponse; import com.yelp.nrtsearch.server.grpc.StopIndexRequest; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import org.slf4j.Logger; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/UpdateFieldsHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/UpdateFieldsHandler.java index f88126739..c2f4b481b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/UpdateFieldsHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/handler/UpdateFieldsHandler.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.FieldDefRequest; import com.yelp.nrtsearch.server.grpc.FieldDefResponse; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import com.yelp.nrtsearch.server.luceneserver.index.handlers.FieldUpdateHandler; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightFetchTask.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightFetchTask.java index be15d2b5d..32a9c92f5 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightFetchTask.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightFetchTask.java @@ -20,9 +20,9 @@ import com.yelp.nrtsearch.server.grpc.Highlight; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.Builder; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.Highlights; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.TextBaseFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.search.FetchTasks.FetchTask; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightUtils.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightUtils.java index 30790a0a9..04dbbba75 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightUtils.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/highlights/HighlightUtils.java @@ -18,9 +18,9 @@ import com.yelp.nrtsearch.server.grpc.Highlight; import com.yelp.nrtsearch.server.grpc.Highlight.Settings; import com.yelp.nrtsearch.server.grpc.Highlight.Type; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; import com.yelp.nrtsearch.server.luceneserver.highlights.HighlightSettings.Builder; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; import com.yelp.nrtsearch.server.utils.StructValueTransformer; import java.util.Collections; import java.util.HashMap; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManager.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManager.java index 60b80bd86..bd517763c 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManager.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManager.java @@ -22,13 +22,11 @@ import com.yelp.nrtsearch.server.grpc.IndexStateInfo; import com.yelp.nrtsearch.server.grpc.Mode; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.index.handlers.FieldUpdateHandler; import com.yelp.nrtsearch.server.luceneserver.index.handlers.FieldUpdateHandler.UpdatedFieldInfo; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.backend.StateBackend; import java.io.IOException; import java.util.Collections; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/DirectoryFactory.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/DirectoryFactory.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/DirectoryFactory.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/index/DirectoryFactory.java index 8c19be68e..c0599d1cb 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/DirectoryFactory.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/DirectoryFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.index; import com.yelp.nrtsearch.server.config.IndexPreloadConfig; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexState.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexState.java index 193f9dfb6..698052b1f 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexState.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexState.java @@ -34,19 +34,16 @@ import com.yelp.nrtsearch.server.grpc.IndexStateInfo; import com.yelp.nrtsearch.server.grpc.Mode; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; -import com.yelp.nrtsearch.server.luceneserver.DirectoryFactory; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ServerCodec; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.codec.ServerCodec; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IdFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.properties.GlobalOrdinalable; import com.yelp.nrtsearch.server.luceneserver.handler.SearchHandler.SearchHandlerException; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import com.yelp.nrtsearch.server.luceneserver.search.sort.SortParser; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.remote.RemoteBackend; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; import java.io.IOException; import java.util.Collections; import java.util.EnumSet; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexAnalyzer.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexAnalyzer.java index 202690821..d5dd00688 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexAnalyzer.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexAnalyzer.java @@ -26,7 +26,7 @@ * Analyzer wrapper for use at indexing time, which finds the proper per field analyzer. This * analyzer is set in the {@link org.apache.lucene.index.IndexWriterConfig} when an index is * started. The {@link IndexStateManager} provides access to the fields in the latest {@link - * com.yelp.nrtsearch.server.luceneserver.IndexState}. + * IndexState}. */ public class IndexAnalyzer extends AnalyzerWrapper { private final IndexStateManager stateManager; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexSimilarity.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexSimilarity.java index 187ddd451..701ccca29 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexSimilarity.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexSimilarity.java @@ -15,7 +15,6 @@ */ package com.yelp.nrtsearch.server.luceneserver.index; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; import org.apache.lucene.search.similarities.BM25Similarity; @@ -26,7 +25,7 @@ * Similarity wrapper for use at indexing time, which finds the proper per field similarity. This * similarity is set in the {@link org.apache.lucene.index.IndexWriterConfig} when an index is * started. The {@link IndexStateManager} provides access to the fields in the latest {@link - * com.yelp.nrtsearch.server.luceneserver.IndexState}. + * IndexState}. */ public class IndexSimilarity extends PerFieldSimilarityWrapper { private static final Similarity DEFAULT_SIMILARITY = new BM25Similarity(); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/IndexState.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexState.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/IndexState.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexState.java index a20d62f9c..f5378be0c 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/IndexState.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexState.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.index; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonObject; @@ -28,12 +28,12 @@ import com.yelp.nrtsearch.server.luceneserver.field.ObjectFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.TextBaseFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.properties.GlobalOrdinalable; -import com.yelp.nrtsearch.server.luceneserver.index.IndexSimilarity; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.warming.Warmer; import com.yelp.nrtsearch.server.luceneserver.warming.WarmerConfig; import com.yelp.nrtsearch.server.remote.RemoteBackend; -import com.yelp.nrtsearch.server.utils.FileUtil; +import com.yelp.nrtsearch.server.utils.FileUtils; import java.io.Closeable; import java.io.IOException; import java.nio.file.Files; @@ -276,7 +276,7 @@ public void initWarmer(RemoteBackend remoteBackend, String indexName) { */ public void deleteIndexRootDir() throws IOException { if (rootDir != null) { - FileUtil.deleteAllFiles(rootDir); + FileUtils.deleteAllFiles(rootDir); } } diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexStateManager.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexStateManager.java index b397838bf..883e0f88a 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexStateManager.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/IndexStateManager.java @@ -20,7 +20,6 @@ import com.yelp.nrtsearch.server.grpc.IndexSettings; import com.yelp.nrtsearch.server.grpc.Mode; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import java.io.Closeable; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/ShardState.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ShardState.java similarity index 99% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/ShardState.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ShardState.java index c01538ffe..863591dd5 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/ShardState.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/ShardState.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.index; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.DeadlineUtils; @@ -23,12 +23,13 @@ import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef.FacetValueType; import com.yelp.nrtsearch.server.luceneserver.field.properties.GlobalOrdinalable; import com.yelp.nrtsearch.server.luceneserver.handler.SearchHandler.SearchHandlerException; -import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; -import com.yelp.nrtsearch.server.luceneserver.index.NrtIndexWriter; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTPrimaryNode; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTReplicaNode; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; +import com.yelp.nrtsearch.server.luceneserver.search.MyIndexSearcher; import com.yelp.nrtsearch.server.luceneserver.warming.WarmerConfig; import com.yelp.nrtsearch.server.monitoring.IndexMetrics; -import com.yelp.nrtsearch.server.utils.FileUtil; +import com.yelp.nrtsearch.server.utils.FileUtils; import com.yelp.nrtsearch.server.utils.HostPort; import io.grpc.StatusRuntimeException; import java.io.Closeable; @@ -247,7 +248,7 @@ public String getState() { /** Delete this shard. */ public void deleteShard() throws IOException { if (rootDir != null) { - FileUtil.deleteAllFiles(rootDir); + FileUtils.deleteAllFiles(rootDir); } } diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/FieldUpdateHandler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/FieldUpdateHandler.java index ac6ad079e..96d4bb9c8 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/FieldUpdateHandler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/FieldUpdateHandler.java @@ -19,13 +19,13 @@ import com.yelp.nrtsearch.server.grpc.FieldDefRequest; import com.yelp.nrtsearch.server.grpc.FieldDefResponse; import com.yelp.nrtsearch.server.grpc.FieldType; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.doc.DocLookup; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.FieldDefCreator; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.VirtualFieldDef; import com.yelp.nrtsearch.server.luceneserver.index.FieldAndFacetState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import com.yelp.nrtsearch.server.luceneserver.script.ScoreScript; import com.yelp.nrtsearch.server.luceneserver.script.ScriptService; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/LiveSettingsV2Handler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/LiveSettingsV2Handler.java index 1c942943c..b72f36d9b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/LiveSettingsV2Handler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/LiveSettingsV2Handler.java @@ -19,9 +19,9 @@ import com.yelp.nrtsearch.server.grpc.IndexLiveSettings; import com.yelp.nrtsearch.server.grpc.LiveSettingsV2Request; import com.yelp.nrtsearch.server.grpc.LiveSettingsV2Response; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.handler.Handler; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/SettingsV2Handler.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/SettingsV2Handler.java index 5df43f21c..ebae4250b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/SettingsV2Handler.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/index/handlers/SettingsV2Handler.java @@ -19,9 +19,9 @@ import com.yelp.nrtsearch.server.grpc.IndexSettings; import com.yelp.nrtsearch.server.grpc.SettingsV2Request; import com.yelp.nrtsearch.server.grpc.SettingsV2Response; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.handler.Handler; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.Status; import io.grpc.stub.StreamObserver; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/innerhit/InnerHitContext.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/innerhit/InnerHitContext.java index e55544726..5725edcfd 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/innerhit/InnerHitContext.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/innerhit/InnerHitContext.java @@ -17,11 +17,11 @@ import com.yelp.nrtsearch.server.grpc.LastHitInfo; import com.yelp.nrtsearch.server.grpc.QuerySortField; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.highlights.HighlightFetchTask; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; import com.yelp.nrtsearch.server.luceneserver.search.FetchTasks; import com.yelp.nrtsearch.server.luceneserver.search.FieldFetchContext; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/NRTPrimaryNode.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NRTPrimaryNode.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/NRTPrimaryNode.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NRTPrimaryNode.java index aaf67ce96..d18d51a57 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/NRTPrimaryNode.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NRTPrimaryNode.java @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.nrt; import com.yelp.nrtsearch.server.grpc.FilesMetadata; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; import com.yelp.nrtsearch.server.grpc.TransferStatus; +import com.yelp.nrtsearch.server.luceneserver.RecvCopyStateHandler; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; -import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; -import com.yelp.nrtsearch.server.luceneserver.nrt.RefreshUploadFuture; import com.yelp.nrtsearch.server.monitoring.NrtMetrics; import com.yelp.nrtsearch.server.utils.HostPort; import io.grpc.Deadline; @@ -245,7 +244,7 @@ void sendNewNRTPointToReplicas() { // TODO: awkward we are forced to do this here ... this should really live in replicator code, // e.g. PrimaryNode.mgr should be this: - static class PrimaryNodeReferenceManager extends ReferenceManager { + public static class PrimaryNodeReferenceManager extends ReferenceManager { final NRTPrimaryNode primary; final SearcherFactory searcherFactory; List nextRefreshWatchers = new ArrayList<>(); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/NRTReplicaNode.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NRTReplicaNode.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/NRTReplicaNode.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NRTReplicaNode.java index 4c0f97312..7bef5125d 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/NRTReplicaNode.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NRTReplicaNode.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.nrt; import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.grpc.FileMetadata; @@ -21,9 +21,6 @@ import com.yelp.nrtsearch.server.grpc.GetNodesResponse; import com.yelp.nrtsearch.server.grpc.NodeInfo; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; -import com.yelp.nrtsearch.server.luceneserver.nrt.DefaultCopyThread; -import com.yelp.nrtsearch.server.luceneserver.nrt.NrtCopyThread; -import com.yelp.nrtsearch.server.luceneserver.nrt.ProportionalCopyThread; import com.yelp.nrtsearch.server.monitoring.NrtMetrics; import com.yelp.nrtsearch.server.utils.HostPort; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtCopyThread.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtCopyThread.java index 03edac676..24be080a1 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtCopyThread.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtCopyThread.java @@ -15,7 +15,6 @@ */ package com.yelp.nrtsearch.server.luceneserver.nrt; -import com.yelp.nrtsearch.server.luceneserver.SimpleCopyJob; import java.io.Closeable; import java.util.Locale; import org.apache.lucene.replicator.nrt.CopyJob; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManager.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManager.java index 6ebe9fc91..dc19c0329 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManager.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManager.java @@ -17,13 +17,12 @@ import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.grpc.RestoreIndex; -import com.yelp.nrtsearch.server.luceneserver.NRTPrimaryNode; import com.yelp.nrtsearch.server.luceneserver.nrt.state.NrtFileMetaData; import com.yelp.nrtsearch.server.luceneserver.nrt.state.NrtPointState; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; -import com.yelp.nrtsearch.server.utils.FileUtil; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.FileUtils; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.io.Closeable; import java.io.FileOutputStream; import java.io.IOException; @@ -177,7 +176,7 @@ public void restoreIfNeeded(Path shardDataDir) throws IOException { return; } if (restoreIndex.getDeleteExistingData()) { - FileUtil.deleteAllFilesInDir(shardDataDir); + FileUtils.deleteAllFilesInDir(shardDataDir); } if (hasRestoreData()) { @@ -346,7 +345,7 @@ private Map uploadDiff(CopyState copyState) throws IOEx if (lastFileMetaData != null && isSameFile(fileMetaData, lastFileMetaData)) { currentPointFiles.put(fileName, lastFileMetaData); } else { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); NrtFileMetaData nrtFileMetaData = new NrtFileMetaData(fileMetaData, ephemeralId, timeString); currentPointFiles.put(fileName, nrtFileMetaData); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/SimpleCopyJob.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/SimpleCopyJob.java similarity index 99% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/SimpleCopyJob.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/SimpleCopyJob.java index b442b723c..56114214a 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/SimpleCopyJob.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/nrt/SimpleCopyJob.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.nrt; import com.yelp.nrtsearch.server.grpc.FileInfo; import com.yelp.nrtsearch.server.grpc.RawFileChunk; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/BlendedTermQuery.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/BlendedTermQuery.java similarity index 99% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/BlendedTermQuery.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/BlendedTermQuery.java index 9b2269270..a1eef819f 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/BlendedTermQuery.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/BlendedTermQuery.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchCrossFieldsQuery.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchCrossFieldsQuery.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchCrossFieldsQuery.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchCrossFieldsQuery.java index bb8e80891..781156c28 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchCrossFieldsQuery.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchCrossFieldsQuery.java @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import com.yelp.nrtsearch.server.grpc.MatchOperator; -import com.yelp.nrtsearch.server.luceneserver.search.query.QueryUtils.TermsAndPositions; import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -68,7 +67,7 @@ public static Query build( BooleanClause.Occur occur = matchOperator == MatchOperator.MUST ? Occur.MUST : Occur.SHOULD; try { // use first field for name in extracted terms - TermsAndPositions termsAndPositions = + QueryUtils.TermsAndPositions termsAndPositions = QueryUtils.getTermsAndPositions(fields.get(0), queryText, analyzer); Query query; if (fields.size() == 1) { @@ -107,7 +106,7 @@ public static Query build( * @throws IOException */ private static Query buildSingleFieldQuery( - TermsAndPositions termsAndPositions, + QueryUtils.TermsAndPositions termsAndPositions, String field, BooleanClause.Occur occur, int minimumShouldMatch) @@ -161,7 +160,7 @@ private static Query buildSingleFieldQuery( * @throws IOException */ private static Query buildMultiFieldQuery( - TermsAndPositions termsAndPositions, + QueryUtils.TermsAndPositions termsAndPositions, List fields, Map fieldBoostMap, BooleanClause.Occur occur, diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchPhrasePrefixQuery.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchPhrasePrefixQuery.java similarity index 99% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchPhrasePrefixQuery.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchPhrasePrefixQuery.java index f574d91c7..8b5d972d5 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchPhrasePrefixQuery.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchPhrasePrefixQuery.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static com.yelp.nrtsearch.server.luceneserver.analysis.AnalyzerCreator.isAnalyzerDefined; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.analysis.AnalyzerCreator; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/MatchQueryBuilder.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchQueryBuilder.java similarity index 92% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/MatchQueryBuilder.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchQueryBuilder.java index 2c213df0d..84f8d2f6f 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/MatchQueryBuilder.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/MatchQueryBuilder.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.query; -import static com.yelp.nrtsearch.server.utils.QueryUtils.computeMaxEditsFromTermLength; +import static com.yelp.nrtsearch.server.luceneserver.query.QueryUtils.computeMaxEditsFromTermLength; import static org.apache.lucene.search.BoostAttribute.DEFAULT_BOOST; import com.yelp.nrtsearch.server.grpc.FuzzyParams; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/QueryNodeMapper.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/QueryNodeMapper.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/QueryNodeMapper.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/QueryNodeMapper.java index 1cb1a7668..edfeb5f5b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/QueryNodeMapper.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/QueryNodeMapper.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.query; import static com.yelp.nrtsearch.server.luceneserver.analysis.AnalyzerCreator.isAnalyzerDefined; -import static com.yelp.nrtsearch.server.utils.QueryUtils.computeMaxEditsFromTermLength; +import static com.yelp.nrtsearch.server.luceneserver.query.QueryUtils.computeMaxEditsFromTermLength; import com.yelp.nrtsearch.server.grpc.ExistsQuery; import com.yelp.nrtsearch.server.grpc.FunctionFilterQuery; @@ -41,11 +41,10 @@ import com.yelp.nrtsearch.server.luceneserver.field.properties.PolygonQueryable; import com.yelp.nrtsearch.server.luceneserver.field.properties.RangeQueryable; import com.yelp.nrtsearch.server.luceneserver.field.properties.TermQueryable; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.query.multifunction.MultiFunctionScoreQuery; import com.yelp.nrtsearch.server.luceneserver.script.ScoreScript; import com.yelp.nrtsearch.server.luceneserver.script.ScriptService; -import com.yelp.nrtsearch.server.luceneserver.search.query.MatchCrossFieldsQuery; -import com.yelp.nrtsearch.server.luceneserver.search.query.MatchPhrasePrefixQuery; -import com.yelp.nrtsearch.server.luceneserver.search.query.multifunction.MultiFunctionScoreQuery; import com.yelp.nrtsearch.server.utils.ScriptParamsUtils; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/QueryUtils.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/QueryUtils.java similarity index 87% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/QueryUtils.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/QueryUtils.java index 069b1f024..5b2aaf7b0 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/QueryUtils.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/QueryUtils.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; +import com.yelp.nrtsearch.server.grpc.FuzzyParams; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -34,6 +35,8 @@ /** Class to hold helper methods for developing lucene queries. */ public class QueryUtils { + private static final int DEFAULT_MAX_EDITS_LOW = 3; // default low value for auto fuzziness + private static final int DEFAULT_MAX_EDITS_HIGH = 6; // default high value for auto fuzziness private QueryUtils() {} @@ -247,4 +250,31 @@ public static TermsAndPositions getTermsAndPositions(String field, TokenStream s return new TermsAndPositions(termArrays, positions); } + + public static int computeMaxEditsFromTermLength( + Term term, FuzzyParams.AutoFuzziness autoFuzziness) { + int maxEdits; + int low = autoFuzziness.getLow(); + int high = autoFuzziness.getHigh(); + int termLength = term.bytes().length; + // If both values are not set, use default values + if (low == 0 && high == 0) { + low = DEFAULT_MAX_EDITS_LOW; + high = DEFAULT_MAX_EDITS_HIGH; + } + if (low < 0) { + throw new IllegalArgumentException("AutoFuzziness low value cannot be negative"); + } + if (low >= high) { + throw new IllegalArgumentException("AutoFuzziness low value should be < high value"); + } + if (termLength >= 0 && termLength < low) { + maxEdits = 0; + } else if (termLength >= low && termLength < high) { + maxEdits = 1; + } else { + maxEdits = 2; + } + return maxEdits; + } } diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/DecayFilterFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/DecayFilterFunction.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/DecayFilterFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/DecayFilterFunction.java index 2791fc52a..006707d65 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/DecayFilterFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/DecayFilterFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import com.yelp.nrtsearch.server.grpc.MultiFunctionScoreQuery; import org.apache.lucene.search.Query; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/DecayFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/DecayFunction.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/DecayFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/DecayFunction.java index af0205e71..0a88721eb 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/DecayFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/DecayFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import org.apache.lucene.search.Explanation; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/ExponentialDecayFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/ExponentialDecayFunction.java similarity index 94% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/ExponentialDecayFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/ExponentialDecayFunction.java index e9556d648..cf37415bb 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/ExponentialDecayFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/ExponentialDecayFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import org.apache.lucene.search.Explanation; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/FilterFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/FilterFunction.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/FilterFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/FilterFunction.java index 7a2f4a353..014fa9365 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/FilterFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/FilterFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import com.yelp.nrtsearch.server.grpc.MultiFunctionScoreQuery; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; import com.yelp.nrtsearch.server.luceneserver.script.ScoreScript; import com.yelp.nrtsearch.server.luceneserver.script.ScriptService; import com.yelp.nrtsearch.server.utils.ScriptParamsUtils; @@ -32,7 +32,7 @@ /** * Function base class used by {@link - * com.yelp.nrtsearch.server.luceneserver.search.query.multifunction.MultiFunctionScoreQuery}. Can + * com.yelp.nrtsearch.server.luceneserver.query.multifunction.MultiFunctionScoreQuery}. Can * optionally have a filter {@link Query} to apply this function only to those matching docs. * Functions may also specify a weight to scale the result. */ diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/GeoPointDecayFilterFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/GeoPointDecayFilterFunction.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/GeoPointDecayFilterFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/GeoPointDecayFilterFunction.java index 19035a143..47f9eb289 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/GeoPointDecayFilterFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/GeoPointDecayFilterFunction.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import com.google.type.LatLng; import com.yelp.nrtsearch.server.grpc.MultiFunctionScoreQuery; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.doc.SegmentDocLookup; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.LatLonFieldDef; import com.yelp.nrtsearch.server.luceneserver.geo.GeoPoint; import com.yelp.nrtsearch.server.luceneserver.geo.GeoUtils; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import java.io.IOException; import java.util.List; import java.util.Objects; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/GuassianDecayFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/GuassianDecayFunction.java similarity index 94% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/GuassianDecayFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/GuassianDecayFunction.java index f291d8e6b..2d437139d 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/GuassianDecayFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/GuassianDecayFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import org.apache.lucene.search.Explanation; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/LinearDecayFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/LinearDecayFunction.java similarity index 94% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/LinearDecayFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/LinearDecayFunction.java index e362cb424..7dee96c88 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/LinearDecayFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/LinearDecayFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import org.apache.lucene.search.Explanation; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/MultiFunctionScoreQuery.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/MultiFunctionScoreQuery.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/MultiFunctionScoreQuery.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/MultiFunctionScoreQuery.java index 667472dff..65ba6034c 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/MultiFunctionScoreQuery.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/MultiFunctionScoreQuery.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import com.yelp.nrtsearch.server.grpc.MultiFunctionScoreQuery.BoostMode; import com.yelp.nrtsearch.server.grpc.MultiFunctionScoreQuery.FunctionScoreMode; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; -import com.yelp.nrtsearch.server.luceneserver.search.query.QueryUtils; -import com.yelp.nrtsearch.server.luceneserver.search.query.multifunction.FilterFunction.LeafFunction; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; +import com.yelp.nrtsearch.server.luceneserver.query.QueryUtils; +import com.yelp.nrtsearch.server.luceneserver.query.multifunction.FilterFunction.LeafFunction; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/ScriptFilterFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/ScriptFilterFunction.java similarity index 94% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/ScriptFilterFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/ScriptFilterFunction.java index 309ebb8a6..10239cb3b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/ScriptFilterFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/ScriptFilterFunction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.util.JsonFormat; import com.yelp.nrtsearch.server.grpc.Script; -import com.yelp.nrtsearch.server.luceneserver.search.query.QueryUtils.SettableDoubleValues; +import com.yelp.nrtsearch.server.luceneserver.query.QueryUtils; import java.io.IOException; import java.util.Objects; import org.apache.lucene.index.LeafReaderContext; @@ -97,7 +97,8 @@ public String toString() { public final class ScriptLeafFunction implements LeafFunction { private final DoubleValues leafValues; - private final SettableDoubleValues innerScoreValues = new SettableDoubleValues(); + private final QueryUtils.SettableDoubleValues innerScoreValues = + new QueryUtils.SettableDoubleValues(); public ScriptLeafFunction(LeafReaderContext context) throws IOException { this.leafValues = scriptSource.getValues(context, innerScoreValues); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/WeightFilterFunction.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/WeightFilterFunction.java similarity index 97% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/WeightFilterFunction.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/WeightFilterFunction.java index dc9794860..3f9ec6276 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/WeightFilterFunction.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/WeightFilterFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import java.io.IOException; import org.apache.lucene.index.LeafReaderContext; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/NrtKnnByteVectorQuery.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/NrtKnnByteVectorQuery.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/NrtKnnByteVectorQuery.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/NrtKnnByteVectorQuery.java index 444f77165..a3c636830 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/NrtKnnByteVectorQuery.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/NrtKnnByteVectorQuery.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.vector; +package com.yelp.nrtsearch.server.luceneserver.query.vector; import org.apache.lucene.search.*; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/NrtKnnFloatVectorQuery.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/NrtKnnFloatVectorQuery.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/NrtKnnFloatVectorQuery.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/NrtKnnFloatVectorQuery.java index 97304c924..833f118cc 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/NrtKnnFloatVectorQuery.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/NrtKnnFloatVectorQuery.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.vector; +package com.yelp.nrtsearch.server.luceneserver.query.vector; import org.apache.lucene.search.KnnFloatVectorQuery; import org.apache.lucene.search.Query; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/WithVectorTotalHits.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/WithVectorTotalHits.java similarity index 94% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/WithVectorTotalHits.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/WithVectorTotalHits.java index b9166b07a..564b0c90e 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/query/vector/WithVectorTotalHits.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/query/vector/WithVectorTotalHits.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.vector; +package com.yelp.nrtsearch.server.luceneserver.query.vector; import org.apache.lucene.search.TotalHits; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcher.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcher.java similarity index 99% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcher.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcher.java index 80d8874aa..73ef942bb 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcher.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.search; import static org.apache.lucene.facet.DrillSidewaysQueryCheck.isDrillSidewaysQuery; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchContext.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchContext.java index 2d60c73e9..4d8c2698c 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchContext.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchContext.java @@ -16,11 +16,11 @@ package com.yelp.nrtsearch.server.luceneserver.search; import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.doc.DocLookup; import com.yelp.nrtsearch.server.luceneserver.doc.SharedDocContext; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.rescore.RescoreTask; import com.yelp.nrtsearch.server.luceneserver.search.collectors.DocCollector; import java.util.List; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchRequestProcessor.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchRequestProcessor.java index 80d41f9b3..9b17ebb52 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchRequestProcessor.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/SearchRequestProcessor.java @@ -27,9 +27,6 @@ import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse; import com.yelp.nrtsearch.server.grpc.VirtualField; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.doc.DefaultSharedDocContext; import com.yelp.nrtsearch.server.luceneserver.doc.DocLookup; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; @@ -39,10 +36,14 @@ import com.yelp.nrtsearch.server.luceneserver.field.properties.VectorQueryable; import com.yelp.nrtsearch.server.luceneserver.highlights.HighlightFetchTask; import com.yelp.nrtsearch.server.luceneserver.highlights.HighlighterService; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.innerhit.InnerHitContext; import com.yelp.nrtsearch.server.luceneserver.innerhit.InnerHitContext.InnerHitContextBuilder; import com.yelp.nrtsearch.server.luceneserver.innerhit.InnerHitFetchTask; import com.yelp.nrtsearch.server.luceneserver.logging.HitsLoggerFetchTask; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; +import com.yelp.nrtsearch.server.luceneserver.query.vector.WithVectorTotalHits; import com.yelp.nrtsearch.server.luceneserver.rescore.QueryRescore; import com.yelp.nrtsearch.server.luceneserver.rescore.RescoreOperation; import com.yelp.nrtsearch.server.luceneserver.rescore.RescoreTask; @@ -58,7 +59,6 @@ import com.yelp.nrtsearch.server.luceneserver.search.collectors.MyTopSuggestDocsCollector; import com.yelp.nrtsearch.server.luceneserver.search.collectors.RelevanceCollector; import com.yelp.nrtsearch.server.luceneserver.search.collectors.SortFieldCollector; -import com.yelp.nrtsearch.server.luceneserver.search.query.vector.WithVectorTotalHits; import com.yelp.nrtsearch.server.utils.ScriptParamsUtils; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/CollectorCreatorContext.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/CollectorCreatorContext.java index 44d0b2dea..76bb0c27d 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/CollectorCreatorContext.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/CollectorCreatorContext.java @@ -16,9 +16,9 @@ package com.yelp.nrtsearch.server.luceneserver.search.collectors; import com.yelp.nrtsearch.server.grpc.SearchRequest; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; import java.util.Map; import org.apache.lucene.facet.taxonomy.SearcherTaxonomyManager.SearcherAndTaxonomy; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollector.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollector.java index 40d6410cb..e246742cb 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollector.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollector.java @@ -21,7 +21,7 @@ import com.yelp.nrtsearch.server.grpc.Rescorer; import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.search.SearchCollectorManager; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; import com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/FilterCollectorManager.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/FilterCollectorManager.java index 4026d6616..27d172266 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/FilterCollectorManager.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/FilterCollectorManager.java @@ -19,14 +19,14 @@ import com.yelp.nrtsearch.server.grpc.FilterResult; import com.yelp.nrtsearch.server.grpc.Query; import com.yelp.nrtsearch.server.grpc.TermInSetQuery; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; +import com.yelp.nrtsearch.server.luceneserver.query.QueryNodeMapper; +import com.yelp.nrtsearch.server.luceneserver.query.QueryUtils; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; import com.yelp.nrtsearch.server.luceneserver.search.collectors.AdditionalCollectorManager; import com.yelp.nrtsearch.server.luceneserver.search.collectors.CollectorCreatorContext; -import com.yelp.nrtsearch.server.luceneserver.search.query.QueryUtils; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/ScriptValueProvider.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/ScriptValueProvider.java index 1769452e9..d83e8917b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/ScriptValueProvider.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/ScriptValueProvider.java @@ -17,9 +17,9 @@ import com.yelp.nrtsearch.server.grpc.Script; import com.yelp.nrtsearch.server.luceneserver.doc.DocLookup; +import com.yelp.nrtsearch.server.luceneserver.query.QueryUtils; import com.yelp.nrtsearch.server.luceneserver.script.ScoreScript; import com.yelp.nrtsearch.server.luceneserver.script.ScriptService; -import com.yelp.nrtsearch.server.luceneserver.search.query.QueryUtils; import com.yelp.nrtsearch.server.utils.ScriptParamsUtils; import java.io.IOException; import org.apache.lucene.index.LeafReaderContext; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalState.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalState.java index 11cfc1bf0..715f3d42b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalState.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalState.java @@ -15,7 +15,7 @@ */ package com.yelp.nrtsearch.server.luceneserver.state; -import static com.yelp.nrtsearch.server.utils.TimeStringUtil.generateTimeStringMs; +import static com.yelp.nrtsearch.server.utils.TimeStringUtils.generateTimeStringMs; import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.config.IndexStartConfig; @@ -32,11 +32,10 @@ import com.yelp.nrtsearch.server.grpc.StartIndexResponse; import com.yelp.nrtsearch.server.grpc.StartIndexV2Request; import com.yelp.nrtsearch.server.grpc.StopIndexRequest; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.StartIndexHandler; import com.yelp.nrtsearch.server.luceneserver.StartIndexHandler.StartIndexHandlerException; import com.yelp.nrtsearch.server.luceneserver.index.BackendStateManager; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import com.yelp.nrtsearch.server.luceneserver.state.backend.LocalStateBackend; import com.yelp.nrtsearch.server.luceneserver.state.backend.RemoteStateBackend; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/GlobalState.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/GlobalState.java similarity index 97% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/GlobalState.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/state/GlobalState.java index 18a0e9668..8566cdc8e 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/GlobalState.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/GlobalState.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.state; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.config.ThreadPoolConfiguration; @@ -24,10 +24,10 @@ import com.yelp.nrtsearch.server.grpc.StartIndexResponse; import com.yelp.nrtsearch.server.grpc.StartIndexV2Request; import com.yelp.nrtsearch.server.grpc.StopIndexRequest; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; -import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; import com.yelp.nrtsearch.server.remote.RemoteBackend; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; import java.io.Closeable; import java.io.IOException; import java.nio.file.Files; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackend.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackend.java index 4b571517d..b84421eb8 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackend.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackend.java @@ -22,7 +22,7 @@ import com.google.protobuf.util.JsonFormat; import com.yelp.nrtsearch.server.grpc.GlobalStateInfo; import com.yelp.nrtsearch.server.grpc.IndexStateInfo; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import java.io.File; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackend.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackend.java index 7cb0b3543..4eb437203 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackend.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackend.java @@ -25,7 +25,7 @@ import com.yelp.nrtsearch.server.config.StateConfig; import com.yelp.nrtsearch.server.grpc.GlobalStateInfo; import com.yelp.nrtsearch.server.grpc.IndexStateInfo; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import com.yelp.nrtsearch.server.remote.RemoteBackend; import java.io.IOException; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/suggest/protocol/ContextSuggestFieldData.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/suggest/ContextSuggestFieldData.java similarity index 95% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/suggest/protocol/ContextSuggestFieldData.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/suggest/ContextSuggestFieldData.java index 7eb8ffff9..1f4852e85 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/suggest/protocol/ContextSuggestFieldData.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/suggest/ContextSuggestFieldData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.suggest.protocol; +package com.yelp.nrtsearch.server.luceneserver.suggest; import java.util.List; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/ByteVectorType.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/vector/ByteVectorType.java similarity index 97% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/ByteVectorType.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/vector/ByteVectorType.java index cbc8a3eca..f08466a9d 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/ByteVectorType.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/vector/ByteVectorType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.doc; +package com.yelp.nrtsearch.server.luceneserver.vector; import java.lang.reflect.Array; import java.util.AbstractList; diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/VectorType.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/vector/FloatVectorType.java similarity index 89% rename from src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/VectorType.java rename to src/main/java/com/yelp/nrtsearch/server/luceneserver/vector/FloatVectorType.java index e5bc446fb..2f25c490a 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/doc/VectorType.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/vector/FloatVectorType.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.doc; +package com.yelp.nrtsearch.server.luceneserver.vector; import java.lang.reflect.Array; import java.util.AbstractList; -public final class VectorType extends AbstractList { +public final class FloatVectorType extends AbstractList { private float[] vectorData; @@ -27,7 +27,7 @@ public final class VectorType extends AbstractList { * * @param vectorData */ - public VectorType(float[] vectorData) { + public FloatVectorType(float[] vectorData) { this.vectorData = vectorData; } @@ -37,7 +37,7 @@ public VectorType(float[] vectorData) { * @param initialCapacity initial vector capacity @Throws IllegalArgumentException – if the * specified capacity is negative */ - public VectorType(int initialCapacity) { + public FloatVectorType(int initialCapacity) { super(); if (initialCapacity < 0) { throw new IllegalArgumentException("vector capacity should be >= 0"); diff --git a/src/main/java/com/yelp/nrtsearch/server/luceneserver/warming/Warmer.java b/src/main/java/com/yelp/nrtsearch/server/luceneserver/warming/Warmer.java index 5c1f9eda9..2466f2a3f 100644 --- a/src/main/java/com/yelp/nrtsearch/server/luceneserver/warming/Warmer.java +++ b/src/main/java/com/yelp/nrtsearch/server/luceneserver/warming/Warmer.java @@ -20,8 +20,8 @@ import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.util.JsonFormat; import com.yelp.nrtsearch.server.grpc.SearchRequest; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.handler.SearchHandler; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteBackend.IndexResourceType; diff --git a/src/main/java/com/yelp/nrtsearch/BackendModule.java b/src/main/java/com/yelp/nrtsearch/server/modules/BackendModule.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/BackendModule.java rename to src/main/java/com/yelp/nrtsearch/server/modules/BackendModule.java index efdaf23c5..b712282cf 100644 --- a/src/main/java/com/yelp/nrtsearch/BackendModule.java +++ b/src/main/java/com/yelp/nrtsearch/server/modules/BackendModule.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch; +package com.yelp.nrtsearch.server.modules; import com.amazonaws.services.s3.AmazonS3; import com.google.inject.*; diff --git a/src/main/java/com/yelp/nrtsearch/LuceneServerModule.java b/src/main/java/com/yelp/nrtsearch/server/modules/LuceneServerModule.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/LuceneServerModule.java rename to src/main/java/com/yelp/nrtsearch/server/modules/LuceneServerModule.java index aa0b75f45..1caad5cfb 100644 --- a/src/main/java/com/yelp/nrtsearch/LuceneServerModule.java +++ b/src/main/java/com/yelp/nrtsearch/server/modules/LuceneServerModule.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch; +package com.yelp.nrtsearch.server.modules; import com.google.inject.AbstractModule; import com.google.inject.Inject; @@ -21,7 +21,6 @@ import com.google.inject.Singleton; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.LuceneServer; -import com.yelp.nrtsearch.server.module.S3Module; import io.prometheus.metrics.model.registry.PrometheusRegistry; import java.io.File; import java.io.FileInputStream; diff --git a/src/main/java/com/yelp/nrtsearch/server/module/S3Module.java b/src/main/java/com/yelp/nrtsearch/server/modules/S3Module.java similarity index 96% rename from src/main/java/com/yelp/nrtsearch/server/module/S3Module.java rename to src/main/java/com/yelp/nrtsearch/server/modules/S3Module.java index 55c5a961f..afa9531c3 100644 --- a/src/main/java/com/yelp/nrtsearch/server/module/S3Module.java +++ b/src/main/java/com/yelp/nrtsearch/server/modules/S3Module.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.module; +package com.yelp.nrtsearch.server.modules; import com.amazonaws.services.s3.AmazonS3; import com.google.inject.AbstractModule; diff --git a/src/main/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollector.java b/src/main/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollector.java index 45304487d..81977c15b 100644 --- a/src/main/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollector.java +++ b/src/main/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollector.java @@ -16,7 +16,7 @@ package com.yelp.nrtsearch.server.monitoring; import com.google.common.annotations.VisibleForTesting; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.prometheus.metrics.core.metrics.Gauge; import io.prometheus.metrics.model.registry.MultiCollector; import io.prometheus.metrics.model.snapshots.MetricSnapshot; diff --git a/src/main/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollector.java b/src/main/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollector.java index fe29cfcd5..4ff9683f3 100644 --- a/src/main/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollector.java +++ b/src/main/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollector.java @@ -16,7 +16,7 @@ package com.yelp.nrtsearch.server.monitoring; import com.google.common.annotations.VisibleForTesting; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.prometheus.metrics.core.metrics.Gauge; import io.prometheus.metrics.model.registry.MultiCollector; import io.prometheus.metrics.model.snapshots.MetricSnapshot; diff --git a/src/main/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollector.java b/src/main/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollector.java index da6bbfcbc..4b44fe086 100644 --- a/src/main/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollector.java +++ b/src/main/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollector.java @@ -18,7 +18,7 @@ import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.grpc.SearchResponse; import com.yelp.nrtsearch.server.grpc.SearchResponse.Diagnostics; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.prometheus.metrics.core.metrics.Counter; import io.prometheus.metrics.core.metrics.Summary; import io.prometheus.metrics.model.registry.MultiCollector; diff --git a/src/main/java/com/yelp/nrtsearch/server/remote/s3/S3Backend.java b/src/main/java/com/yelp/nrtsearch/server/remote/s3/S3Backend.java index f2b22c86e..ad0b3a978 100644 --- a/src/main/java/com/yelp/nrtsearch/server/remote/s3/S3Backend.java +++ b/src/main/java/com/yelp/nrtsearch/server/remote/s3/S3Backend.java @@ -15,7 +15,7 @@ */ package com.yelp.nrtsearch.server.remote.s3; -import static com.yelp.nrtsearch.server.utils.TimeStringUtil.generateTimeStringSec; +import static com.yelp.nrtsearch.server.utils.TimeStringUtils.generateTimeStringSec; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3URI; @@ -35,7 +35,7 @@ import com.yelp.nrtsearch.server.luceneserver.nrt.state.NrtPointState; import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import com.yelp.nrtsearch.server.remote.RemoteBackend; -import com.yelp.nrtsearch.server.utils.ZipUtil; +import com.yelp.nrtsearch.server.utils.ZipUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -127,7 +127,7 @@ public AmazonS3 getS3() { public String downloadPluginIfNeeded(String pluginNameOrPath, Path destPath) { if (S3Util.isValidS3FilePath(pluginNameOrPath) && pluginNameOrPath.endsWith(ZIP_EXTENSION)) { logger.info("Downloading plugin: {}", pluginNameOrPath); - ZipUtil.extractZip(downloadFromS3Path(pluginNameOrPath), destPath, saveBeforeUnzip); + ZipUtils.extractZip(downloadFromS3Path(pluginNameOrPath), destPath, saveBeforeUnzip); // Assuming that the plugin directory is same as the name of the file return S3Util.getS3FileName(pluginNameOrPath).split(".zip")[0]; } diff --git a/src/main/java/com/yelp/nrtsearch/server/utils/FileUtil.java b/src/main/java/com/yelp/nrtsearch/server/utils/FileUtils.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/utils/FileUtil.java rename to src/main/java/com/yelp/nrtsearch/server/utils/FileUtils.java index 8a0ddcf27..75ed942d8 100644 --- a/src/main/java/com/yelp/nrtsearch/server/utils/FileUtil.java +++ b/src/main/java/com/yelp/nrtsearch/server/utils/FileUtils.java @@ -21,7 +21,7 @@ import java.nio.file.Path; /** Util class for filesystem operations */ -public class FileUtil { +public class FileUtils { /** * Deletes a directory recursively. diff --git a/src/main/java/com/yelp/nrtsearch/server/utils/QueryUtils.java b/src/main/java/com/yelp/nrtsearch/server/utils/QueryUtils.java deleted file mode 100644 index ded919ef0..000000000 --- a/src/main/java/com/yelp/nrtsearch/server/utils/QueryUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 Yelp Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.yelp.nrtsearch.server.utils; - -import com.yelp.nrtsearch.server.grpc.FuzzyParams; -import org.apache.lucene.index.Term; - -public class QueryUtils { - private static final int DEFAULT_LOW = 3; // default low value for auto fuzziness - private static final int DEFAULT_HIGH = 6; // default high value for auto fuzziness - - public static int computeMaxEditsFromTermLength( - Term term, FuzzyParams.AutoFuzziness autoFuzziness) { - int maxEdits; - int low = autoFuzziness.getLow(); - int high = autoFuzziness.getHigh(); - int termLength = term.bytes().length; - // If both values are not set, use default values - if (low == 0 && high == 0) { - low = DEFAULT_LOW; - high = DEFAULT_HIGH; - } - if (low < 0) { - throw new IllegalArgumentException("AutoFuzziness low value cannot be negative"); - } - if (low >= high) { - throw new IllegalArgumentException("AutoFuzziness low value should be < high value"); - } - if (termLength >= 0 && termLength < low) { - maxEdits = 0; - } else if (termLength >= low && termLength < high) { - maxEdits = 1; - } else { - maxEdits = 2; - } - return maxEdits; - } -} diff --git a/src/main/java/com/yelp/nrtsearch/server/utils/TimeStringUtil.java b/src/main/java/com/yelp/nrtsearch/server/utils/TimeStringUtils.java similarity index 98% rename from src/main/java/com/yelp/nrtsearch/server/utils/TimeStringUtil.java rename to src/main/java/com/yelp/nrtsearch/server/utils/TimeStringUtils.java index 6b717e573..b4a63a098 100644 --- a/src/main/java/com/yelp/nrtsearch/server/utils/TimeStringUtil.java +++ b/src/main/java/com/yelp/nrtsearch/server/utils/TimeStringUtils.java @@ -21,14 +21,14 @@ import java.time.format.DateTimeFormatter; /** Utility class for generating and validating time strings. */ -public class TimeStringUtil { +public class TimeStringUtils { private static final DateTimeFormatter MSEC_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"); private static final DateTimeFormatter SEC_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); - private TimeStringUtil() {} + private TimeStringUtils() {} /** Generate a unique time string based on the current UTC time formatted as yyyyMMddHHmmssSSS. */ public static String generateTimeStringMs() { diff --git a/src/main/java/com/yelp/nrtsearch/server/utils/ZipUtil.java b/src/main/java/com/yelp/nrtsearch/server/utils/ZipUtils.java similarity index 99% rename from src/main/java/com/yelp/nrtsearch/server/utils/ZipUtil.java rename to src/main/java/com/yelp/nrtsearch/server/utils/ZipUtils.java index 475445200..ac765985c 100644 --- a/src/main/java/com/yelp/nrtsearch/server/utils/ZipUtil.java +++ b/src/main/java/com/yelp/nrtsearch/server/utils/ZipUtils.java @@ -30,9 +30,9 @@ import org.slf4j.LoggerFactory; /** Utility class to extract Zip files. */ -public class ZipUtil { +public class ZipUtils { - private static final Logger logger = LoggerFactory.getLogger(ZipUtil.class); + private static final Logger logger = LoggerFactory.getLogger(ZipUtils.class); /** * Extract a zip file. diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommand.java index 5d1ff97b6..1ab611366 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommand.java @@ -21,7 +21,7 @@ import com.amazonaws.services.s3.model.S3ObjectSummary; import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import com.yelp.nrtsearch.tools.nrt_utils.state.StateCommandUtils; import java.util.ArrayList; import java.util.Comparator; @@ -176,8 +176,8 @@ private void deleteSnapshotIndexData( for (String prefix : dataPrefixes) { String[] splits = prefix.split("/"); String timeString = splits[splits.length - 1]; - if (TimeStringUtil.isTimeStringMs(timeString)) { - long dataTimestamp = TimeStringUtil.parseTimeStringMs(timeString).toEpochMilli(); + if (TimeStringUtils.isTimeStringMs(timeString)) { + long dataTimestamp = TimeStringUtils.parseTimeStringMs(timeString).toEpochMilli(); if (dataTimestamp < minTimestampMs) { deletePrefixes.add(prefix); } @@ -250,8 +250,8 @@ private List getSnapshotTimestamps( for (S3ObjectSummary objectSummary : result.getObjectSummaries()) { String snapshotSuffix = objectSummary.getKey().split(metadataPrefix)[1]; - if (TimeStringUtil.isTimeStringMs(snapshotSuffix)) { - long timestampMs = TimeStringUtil.parseTimeStringMs(snapshotSuffix).toEpochMilli(); + if (TimeStringUtils.isTimeStringMs(snapshotSuffix)) { + long timestampMs = TimeStringUtils.parseTimeStringMs(snapshotSuffix).toEpochMilli(); snapshotTimestamps.add(new TimestampAndTimeString(timestampMs, snapshotSuffix)); } else { System.out.println("Skipping invalid timestamp: " + snapshotSuffix); diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/ListSnapshotsCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/ListSnapshotsCommand.java index faa04da73..cd76cdf86 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/ListSnapshotsCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/ListSnapshotsCommand.java @@ -19,7 +19,7 @@ import com.amazonaws.services.s3.model.ListObjectsV2Request; import com.amazonaws.services.s3.model.ListObjectsV2Result; import com.amazonaws.services.s3.model.S3ObjectSummary; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import com.yelp.nrtsearch.tools.nrt_utils.state.StateCommandUtils; import java.time.format.DateTimeParseException; import java.util.concurrent.Callable; @@ -117,7 +117,7 @@ static String getTimestampStr(String snapshotSuffix) { } String timestampStr = splits[1]; try { - return TimeStringUtil.parseTimeStringMs(timestampStr).toString(); + return TimeStringUtils.parseTimeStringMs(timestampStr).toString(); } catch (DateTimeParseException e) { return null; } diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/RestoreCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/RestoreCommand.java index 22a3dd84b..010e14944 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/RestoreCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/RestoreCommand.java @@ -33,7 +33,7 @@ import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import com.yelp.nrtsearch.tools.nrt_utils.state.StateCommandUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -312,9 +312,9 @@ private String getRestoreIndexResource() { private String getRestoreIndexId() { if (restoreIndexId == null) { - return TimeStringUtil.generateTimeStringMs(); + return TimeStringUtils.generateTimeStringMs(); } else { - if (!TimeStringUtil.isTimeStringMs(restoreIndexId)) { + if (!TimeStringUtils.isTimeStringMs(restoreIndexId)) { throw new IllegalStateException( "restoreIndexId must be a time string of the form yyyyMMddHHmmssSSS, got: " + restoreIndexId); diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotCommand.java index 724c527d7..b29fe06a7 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotCommand.java @@ -30,7 +30,7 @@ import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import com.yelp.nrtsearch.tools.nrt_utils.state.StateCommandUtils; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -126,7 +126,7 @@ public Integer call() throws Exception { String resolvedIndexResource = StateCommandUtils.getResourceName(s3Backend, serviceName, indexName, exactResourceName); - String timeStringMs = TimeStringUtil.generateTimeStringMs(); + String timeStringMs = TimeStringUtils.generateTimeStringMs(); String resolvedSnapshotRoot = BackupCommandUtils.getSnapshotRoot(snapshotRoot, serviceName); String snapshotIndexDataRoot = BackupCommandUtils.getSnapshotIndexDataRoot( diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommand.java index ffcf26d68..c3ba3c560 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommand.java @@ -27,7 +27,7 @@ import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import com.yelp.nrtsearch.tools.nrt_utils.backup.BackupCommandUtils; import com.yelp.nrtsearch.tools.nrt_utils.state.StateCommandUtils; import java.util.ArrayList; @@ -234,7 +234,7 @@ static long validatePSNameAndGetTimestampMs(String pointStateFileName) { UUID.fromString(uuidString); Long.valueOf(parts[6]); String timeString = pointStateFileName.split("-")[0]; - return TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + return TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); } catch (Exception e) { throw new IllegalArgumentException("Invalid point state name: " + pointStateFileName, e); } @@ -259,7 +259,7 @@ static long validateDataNameAndGetTimestampMs(String dataFileName) { String uuidString = String.join("-", parts[1], parts[2], parts[3], parts[4], parts[5]); UUID.fromString(uuidString); String timeString = dataFileName.split("-")[0]; - return TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + return TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); } catch (Exception e) { throw new IllegalArgumentException("Invalid data name: " + dataFileName, e); } diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/ListResourceVersions.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/ListResourceVersions.java index e4b459fb3..a0bbf428d 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/ListResourceVersions.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/ListResourceVersions.java @@ -21,7 +21,7 @@ import com.google.common.annotations.VisibleForTesting; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.util.concurrent.Callable; import picocli.CommandLine; @@ -150,8 +150,8 @@ private static void printVersion(String keySuffix) { String[] splits = keySuffix.split("-"); if (splits.length > 1) { String timeString = splits[0]; - if (TimeStringUtil.isTimeStringSec(timeString)) { - timestampStr = " (" + TimeStringUtil.parseTimeStringSec(timeString).toString() + ")"; + if (TimeStringUtils.isTimeStringSec(timeString)) { + timestampStr = " (" + TimeStringUtils.parseTimeStringSec(timeString).toString() + ")"; } } System.out.println(keySuffix + timestampStr); diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/PutRemoteStateCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/PutRemoteStateCommand.java index 7ae241c1b..75e2035f1 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/PutRemoteStateCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/PutRemoteStateCommand.java @@ -17,7 +17,6 @@ import com.amazonaws.services.s3.AmazonS3; import com.google.common.annotations.VisibleForTesting; -import com.yelp.nrtsearch.server.luceneserver.IndexBackupUtils; import com.yelp.nrtsearch.server.remote.s3.S3Backend; import java.nio.file.Files; import java.nio.file.Path; @@ -115,7 +114,7 @@ public Integer call() throws Exception { byte[] fileBytes = Files.readAllBytes(Path.of(stateFile)); if (!skipValidate) { StateCommandUtils.validateConfigData( - fileBytes, IndexBackupUtils.isBackendGlobalState(resolvedResourceName)); + fileBytes, StateCommandUtils.isGlobalState(resolvedResourceName)); } if (backupFile != null) { diff --git a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/UpdateGlobalIndexStateCommand.java b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/UpdateGlobalIndexStateCommand.java index 6b78f2944..69d4437ea 100644 --- a/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/UpdateGlobalIndexStateCommand.java +++ b/src/main/java/com/yelp/nrtsearch/tools/nrt_utils/state/UpdateGlobalIndexStateCommand.java @@ -24,7 +24,7 @@ import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.util.concurrent.Callable; import picocli.CommandLine; @@ -103,7 +103,7 @@ static boolean validateParams(String started, String dateTimeString) { } } if (dateTimeString != null) { - if (!TimeStringUtil.isTimeStringMs(dateTimeString)) { + if (!TimeStringUtils.isTimeStringMs(dateTimeString)) { System.out.println("Invalid date time format: " + dateTimeString); return false; } diff --git a/src/test/java/com/yelp/nrtsearch/clientlib/NodeNameResolverAndLoadBalancingTests.java b/src/test/java/com/yelp/nrtsearch/clientlib/NodeNameResolverAndLoadBalancingTests.java index 99e08af74..e2f938674 100644 --- a/src/test/java/com/yelp/nrtsearch/clientlib/NodeNameResolverAndLoadBalancingTests.java +++ b/src/test/java/com/yelp/nrtsearch/clientlib/NodeNameResolverAndLoadBalancingTests.java @@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.CommitRequest; @@ -38,6 +37,7 @@ import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse; import com.yelp.nrtsearch.server.grpc.StartIndexRequest; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.Status; import io.grpc.StatusRuntimeException; import io.grpc.stub.StreamObserver; diff --git a/src/test/java/com/yelp/nrtsearch/module/TestLuceneServerModule.java b/src/test/java/com/yelp/nrtsearch/module/TestLuceneServerModule.java index bd88c0c31..d0eae5cb1 100644 --- a/src/test/java/com/yelp/nrtsearch/module/TestLuceneServerModule.java +++ b/src/test/java/com/yelp/nrtsearch/module/TestLuceneServerModule.java @@ -20,8 +20,8 @@ import com.google.inject.Inject; import com.google.inject.Provides; import com.google.inject.Singleton; -import com.yelp.nrtsearch.BackendModule; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; +import com.yelp.nrtsearch.server.modules.BackendModule; /** * A Guice module to initialize {@link com.yelp.nrtsearch.server.grpc.LuceneServer} instance for diff --git a/src/test/java/com/yelp/nrtsearch/server/config/ThreadPoolConfigurationTest.java b/src/test/java/com/yelp/nrtsearch/server/config/ThreadPoolConfigurationTest.java index 76b81c16a..fe55669ac 100644 --- a/src/test/java/com/yelp/nrtsearch/server/config/ThreadPoolConfigurationTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/config/ThreadPoolConfigurationTest.java @@ -17,7 +17,7 @@ import static org.junit.Assert.*; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/AckedCopyTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/AckedCopyTest.java index 1e0e5c9f5..0da1888e0 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/AckedCopyTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/AckedCopyTest.java @@ -19,10 +19,10 @@ import static com.yelp.nrtsearch.server.grpc.ReplicationServerTest.validateSearchResults; import com.amazonaws.services.s3.AmazonS3; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.test_utils.AmazonS3Provider; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/CustomFieldTypeTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/CustomFieldTypeTest.java index 95ee9629c..815e39710 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/CustomFieldTypeTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/CustomFieldTypeTest.java @@ -18,7 +18,6 @@ import static com.yelp.nrtsearch.server.grpc.GrpcServer.rmDir; import static org.junit.Assert.assertEquals; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.luceneserver.doc.LoadedDocValues; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; @@ -26,6 +25,7 @@ import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; import com.yelp.nrtsearch.server.plugins.FieldTypePlugin; import com.yelp.nrtsearch.server.plugins.Plugin; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.StatusRuntimeException; import io.grpc.testing.GrpcCleanupRule; import io.prometheus.metrics.model.registry.PrometheusRegistry; diff --git a/src/test/java/com/yelp/nrtsearch/server/ExistsQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/ExistsQueryTest.java similarity index 98% rename from src/test/java/com/yelp/nrtsearch/server/ExistsQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/grpc/ExistsQueryTest.java index 0546f376c..6e572ca52 100644 --- a/src/test/java/com/yelp/nrtsearch/server/ExistsQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/ExistsQueryTest.java @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server; +package com.yelp.nrtsearch.server.grpc; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.yelp.nrtsearch.server.grpc.*; import com.yelp.nrtsearch.server.grpc.AddDocumentRequest.MultiValuedField; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; import io.grpc.testing.GrpcCleanupRule; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServer.java b/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServer.java index 7f8cf9790..f3a0755f2 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServer.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServer.java @@ -19,7 +19,7 @@ import com.google.protobuf.util.JsonFormat; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.LuceneServer.LuceneServerImpl; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.monitoring.Configuration; import com.yelp.nrtsearch.server.monitoring.LuceneServerMonitoringServerInterceptor; import com.yelp.nrtsearch.server.plugins.Plugin; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplierTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplierTest.java index 3e3a617f9..61975baa6 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplierTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/GrpcServerExecutorSupplierTest.java @@ -21,7 +21,7 @@ import com.yelp.nrtsearch.server.config.ThreadPoolConfiguration; import com.yelp.nrtsearch.server.config.YamlConfigReader; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import io.grpc.Metadata; import io.grpc.MethodDescriptor; import io.grpc.ServerCall; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/IndexStartTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/IndexStartTest.java index c28e5a56d..80e99e90c 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/IndexStartTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/IndexStartTest.java @@ -24,7 +24,7 @@ import com.google.protobuf.BoolValue; import com.google.protobuf.Int32Value; import com.yelp.nrtsearch.server.config.IndexStartConfig.IndexDataLocationType; -import com.yelp.nrtsearch.server.luceneserver.NRTReplicaNode; +import com.yelp.nrtsearch.server.luceneserver.nrt.NRTReplicaNode; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Collections; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerIdFieldTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerIdFieldTest.java index ca15d3596..15b13efc4 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerIdFieldTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerIdFieldTest.java @@ -20,8 +20,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.StatusRuntimeException; import io.grpc.testing.GrpcCleanupRule; import io.prometheus.metrics.model.registry.PrometheusRegistry; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerTest.java index 6407133b1..d5bd264f6 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/LuceneServerTest.java @@ -27,7 +27,6 @@ import com.amazonaws.services.s3.AmazonS3; import com.google.api.HttpBody; import com.google.protobuf.Empty; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.LuceneServer.LuceneServerImpl; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.CompositeFieldValue; @@ -35,6 +34,7 @@ import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.test_utils.AmazonS3Provider; import io.grpc.StatusRuntimeException; import io.grpc.testing.GrpcCleanupRule; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/MergeBehaviorTests.java b/src/test/java/com/yelp/nrtsearch/server/grpc/MergeBehaviorTests.java index e7489db16..99c544864 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/MergeBehaviorTests.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/MergeBehaviorTests.java @@ -20,9 +20,9 @@ import static org.junit.Assert.*; import com.google.common.collect.Sets; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.testing.GrpcCleanupRule; import io.prometheus.metrics.model.registry.PrometheusRegistry; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MultiIndexAddDocumentsTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/MultiIndexAddDocumentsTest.java similarity index 91% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/MultiIndexAddDocumentsTest.java rename to src/test/java/com/yelp/nrtsearch/server/grpc/MultiIndexAddDocumentsTest.java index 94ce19ed1..707c1f868 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MultiIndexAddDocumentsTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/MultiIndexAddDocumentsTest.java @@ -13,22 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.grpc; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.AddDocumentRequest.MultiValuedField; -import com.yelp.nrtsearch.server.grpc.CreateIndexRequest; -import com.yelp.nrtsearch.server.grpc.FieldDefRequest; -import com.yelp.nrtsearch.server.grpc.LiveSettingsRequest; -import com.yelp.nrtsearch.server.grpc.LuceneServerClientBuilder; -import com.yelp.nrtsearch.server.grpc.LuceneServerGrpc; -import com.yelp.nrtsearch.server.grpc.RefreshRequest; -import com.yelp.nrtsearch.server.grpc.SearchRequest; -import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.grpc.StartIndexRequest; +import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.io.Reader; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/NestedFieldTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/NestedFieldTest.java index 6626942e5..ab5eba354 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/NestedFieldTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/NestedFieldTest.java @@ -18,7 +18,7 @@ import static org.junit.Assert.*; import com.yelp.nrtsearch.server.config.IndexStartConfig; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import java.io.IOException; import java.util.stream.Stream; import org.junit.After; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/QueryTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/QueryTest.java index 4a8ca134b..ac1ae8419 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/QueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/QueryTest.java @@ -20,8 +20,8 @@ import com.google.protobuf.Any; import com.google.protobuf.InvalidProtocolBufferException; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.nio.file.Paths; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClientTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClientTest.java index 19538e3a7..14fdb67d0 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClientTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerClientTest.java @@ -31,7 +31,7 @@ import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.LuceneServer.ReplicationServerImpl; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient.DiscoveryFileAndPort; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.grpc.ManagedChannelBuilder; import io.grpc.Server; import io.grpc.ServerBuilder; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerTest.java index 24005a58e..c763ddf9c 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/ReplicationServerTest.java @@ -21,10 +21,10 @@ import static org.junit.Assert.assertTrue; import com.amazonaws.services.s3.AmazonS3; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.test_utils.AmazonS3Provider; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/TestServer.java b/src/test/java/com/yelp/nrtsearch/server/grpc/TestServer.java index cc075712f..d5ffd3c23 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/TestServer.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/TestServer.java @@ -34,13 +34,13 @@ import com.yelp.nrtsearch.server.grpc.LuceneServer.LuceneServerImpl; import com.yelp.nrtsearch.server.grpc.LuceneServer.ReplicationServerImpl; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.FileUtil; +import com.yelp.nrtsearch.server.utils.FileUtils; import io.findify.s3mock.S3Mock; import io.grpc.Server; import io.grpc.ServerBuilder; @@ -234,7 +234,7 @@ public void stop(boolean clearData) { } if (clearData) { try { - FileUtil.deleteAllFiles(globalState.getIndexDirBase()); + FileUtils.deleteAllFiles(globalState.getIndexDirBase()); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/com/yelp/nrtsearch/server/grpc/TimeoutTest.java b/src/test/java/com/yelp/nrtsearch/server/grpc/TimeoutTest.java index 9c72c7bb7..31bf2e5a1 100644 --- a/src/test/java/com/yelp/nrtsearch/server/grpc/TimeoutTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/grpc/TimeoutTest.java @@ -20,10 +20,10 @@ import static org.junit.Assert.assertTrue; import com.yelp.nrtsearch.server.grpc.SearchResponse.Diagnostics; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.facet.DrillSidewaysImpl; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.search.SearchCollectorManager; import com.yelp.nrtsearch.server.luceneserver.search.SearchContext; import com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerTestCase.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerTestCase.java index eaf9c9b9a..002561ced 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerTestCase.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerTestCase.java @@ -20,7 +20,6 @@ import com.google.gson.Gson; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.util.JsonFormat; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.AddDocumentResponse; @@ -34,7 +33,9 @@ import com.yelp.nrtsearch.server.grpc.RefreshRequest; import com.yelp.nrtsearch.server.grpc.SettingsRequest; import com.yelp.nrtsearch.server.grpc.StartIndexRequest; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.plugins.Plugin; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.stub.StreamObserver; import io.grpc.testing.GrpcCleanupRule; import io.prometheus.metrics.model.registry.PrometheusRegistry; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerCodecTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/codec/ServerCodecTest.java similarity index 98% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerCodecTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/codec/ServerCodecTest.java index 6b274cf54..05aa179ac 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/ServerCodecTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/codec/ServerCodecTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.codec; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -23,6 +23,7 @@ import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.IndexableFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.VectorFieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; import com.yelp.nrtsearch.server.luceneserver.similarity.SimilarityCreator; import java.io.ByteArrayInputStream; diff --git a/src/test/java/com/yelp/nrtsearch/server/utils/ThreadPoolExecutorFactoryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/concurrent/ThreadPoolExecutorFactoryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/utils/ThreadPoolExecutorFactoryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/concurrent/ThreadPoolExecutorFactoryTest.java index 4ab55c45c..819c5b4a8 100644 --- a/src/test/java/com/yelp/nrtsearch/server/utils/ThreadPoolExecutorFactoryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/concurrent/ThreadPoolExecutorFactoryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.utils; +package com.yelp.nrtsearch.server.luceneserver.concurrent; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/facet/EagerGlobalOrdinalsTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/facet/EagerGlobalOrdinalsTest.java index 794647e97..4334e7766 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/facet/EagerGlobalOrdinalsTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/facet/EagerGlobalOrdinalsTest.java @@ -25,8 +25,8 @@ import com.yelp.nrtsearch.server.grpc.RefreshRequest; import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.util.ArrayList; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/field/EagerFieldOrdinalTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/field/EagerFieldOrdinalTest.java index 87864a3bb..a26bf5ea0 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/field/EagerFieldOrdinalTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/field/EagerFieldOrdinalTest.java @@ -27,7 +27,7 @@ import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.TermsCollector; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.search.GlobalOrdinalLookup; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManagerTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManagerTest.java index 8f82a8e46..f96044892 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManagerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BackendStateManagerTest.java @@ -38,12 +38,11 @@ import com.yelp.nrtsearch.server.grpc.IndexStateInfo; import com.yelp.nrtsearch.server.grpc.Mode; import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDefCreator; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import com.yelp.nrtsearch.server.luceneserver.similarity.SimilarityCreator; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.backend.StateBackend; import com.yelp.nrtsearch.server.plugins.Plugin; import java.io.ByteArrayInputStream; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BucketedTieredMergePolicyTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BucketedTieredMergePolicyTest.java index d32ff78fe..e9e4a6c0c 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BucketedTieredMergePolicyTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/BucketedTieredMergePolicyTest.java @@ -29,7 +29,6 @@ import com.yelp.nrtsearch.server.grpc.SearchResponse; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.util.ArrayList; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/DirectoryFactoryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/DirectoryFactoryTest.java similarity index 98% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/DirectoryFactoryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/index/DirectoryFactoryTest.java index 22118fcd4..3cd78ae97 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/DirectoryFactoryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/DirectoryFactoryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.index; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexStateTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexStateTest.java index acfad1626..a3ec94efc 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexStateTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/index/ImmutableIndexStateTest.java @@ -47,10 +47,6 @@ import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; import com.yelp.nrtsearch.server.grpc.SortFields; import com.yelp.nrtsearch.server.grpc.SortType; -import com.yelp.nrtsearch.server.luceneserver.DirectoryFactory; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.AtomFieldDef; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.FieldDefCreator; @@ -61,6 +57,7 @@ import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import com.yelp.nrtsearch.server.luceneserver.similarity.SimilarityCreator; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.plugins.Plugin; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/DefaultCopyThreadTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/DefaultCopyThreadTest.java index 4bf7f73e0..e0a4bd56e 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/DefaultCopyThreadTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/DefaultCopyThreadTest.java @@ -19,7 +19,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.yelp.nrtsearch.server.luceneserver.SimpleCopyJob; import java.io.IOException; import java.util.Collections; import org.apache.lucene.replicator.nrt.CopyJob; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManagerTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManagerTest.java index 71158cd81..703ccd264 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManagerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtDataManagerTest.java @@ -34,12 +34,11 @@ import static org.mockito.Mockito.when; import com.yelp.nrtsearch.server.grpc.RestoreIndex; -import com.yelp.nrtsearch.server.luceneserver.NRTPrimaryNode; import com.yelp.nrtsearch.server.luceneserver.nrt.state.NrtFileMetaData; import com.yelp.nrtsearch.server.luceneserver.nrt.state.NrtPointState; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.file.Files; @@ -915,7 +914,7 @@ private void verifyFilesMetaData( assertEquals(value.primaryId, actualValue.primaryId); assertArrayEquals(value.header, actualValue.header); assertArrayEquals(value.footer, actualValue.footer); - assertTrue(TimeStringUtil.isTimeStringSec(actualValue.timeString)); + assertTrue(TimeStringUtils.isTimeStringSec(actualValue.timeString)); }); } } diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/NrtReplicaNodeTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtReplicaNodeTest.java similarity index 80% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/NrtReplicaNodeTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtReplicaNodeTest.java index 3e246fc87..7b660a7f4 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/NrtReplicaNodeTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/NrtReplicaNodeTest.java @@ -13,13 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.nrt; import static org.junit.Assert.assertTrue; -import com.yelp.nrtsearch.server.luceneserver.nrt.DefaultCopyThread; -import com.yelp.nrtsearch.server.luceneserver.nrt.NrtCopyThread; -import com.yelp.nrtsearch.server.luceneserver.nrt.ProportionalCopyThread; import org.junit.Test; public class NrtReplicaNodeTest { diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/PrimaryNodeReferenceManagerTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/PrimaryNodeReferenceManagerTest.java similarity index 98% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/PrimaryNodeReferenceManagerTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/PrimaryNodeReferenceManagerTest.java index 9eb551a0f..fc23eb488 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/PrimaryNodeReferenceManagerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/PrimaryNodeReferenceManagerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.nrt; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -29,8 +29,6 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; -import com.yelp.nrtsearch.server.luceneserver.nrt.RefreshUploadFuture; import java.io.IOException; import java.util.List; import java.util.concurrent.ExecutionException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/ProportionalCopyThreadTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/ProportionalCopyThreadTest.java index a1a8e6348..08870ea88 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/ProportionalCopyThreadTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/ProportionalCopyThreadTest.java @@ -19,7 +19,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.yelp.nrtsearch.server.luceneserver.SimpleCopyJob; import java.io.IOException; import java.util.Collections; import org.apache.lucene.replicator.nrt.CopyJob; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/SimpleCopyJobTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/SimpleCopyJobTest.java similarity index 97% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/SimpleCopyJobTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/SimpleCopyJobTest.java index 122db5454..475d1239a 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/SimpleCopyJobTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/nrt/SimpleCopyJobTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.nrt; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -30,7 +30,7 @@ import com.google.protobuf.ByteString; import com.yelp.nrtsearch.server.grpc.FileInfo; import com.yelp.nrtsearch.server.grpc.RawFileChunk; -import com.yelp.nrtsearch.server.luceneserver.SimpleCopyJob.FileChunkStreamingIterator; +import com.yelp.nrtsearch.server.luceneserver.nrt.SimpleCopyJob.FileChunkStreamingIterator; import io.grpc.stub.StreamObserver; import java.util.Arrays; import java.util.List; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/ConstantScoreQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/ConstantScoreQueryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/ConstantScoreQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/ConstantScoreQueryTest.java index 2a7b7113a..9a15fe79f 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/ConstantScoreQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/ConstantScoreQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchCrossFieldsQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchCrossFieldsQueryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchCrossFieldsQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchCrossFieldsQueryTest.java index edde2a67e..69fab2bd9 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchCrossFieldsQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchCrossFieldsQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchPhrasePrefixQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchPhrasePrefixQueryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchPhrasePrefixQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchPhrasePrefixQueryTest.java index 20938d8ab..dfc1e9093 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MatchPhrasePrefixQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchPhrasePrefixQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MatchQueryBuilderTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchQueryBuilderTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/MatchQueryBuilderTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchQueryBuilderTest.java index d200b36ab..bfdc1e50b 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MatchQueryBuilderTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MatchQueryBuilderTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MultiMatchPhrasePrefixQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MultiMatchPhrasePrefixQueryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MultiMatchPhrasePrefixQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MultiMatchPhrasePrefixQueryTest.java index 05799e75e..b7d54afab 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/MultiMatchPhrasePrefixQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/MultiMatchPhrasePrefixQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/PrefixQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/PrefixQueryTest.java similarity index 98% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/PrefixQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/PrefixQueryTest.java index 567170bd2..490fc9975 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/PrefixQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/PrefixQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; @@ -28,9 +28,8 @@ import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.QueryNodeMapper; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import io.grpc.StatusRuntimeException; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/QueryNodeMapperTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/QueryNodeMapperTest.java similarity index 97% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/QueryNodeMapperTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/QueryNodeMapperTest.java index 5d75a9706..30274989c 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/QueryNodeMapperTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/QueryNodeMapperTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -21,7 +21,10 @@ import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.*; import com.yelp.nrtsearch.server.grpc.SearchResponse.Diagnostics; +import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; import com.yelp.nrtsearch.server.luceneserver.doc.DocLookup; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.script.ScoreScript; import com.yelp.nrtsearch.server.luceneserver.script.ScriptContext; import com.yelp.nrtsearch.server.luceneserver.script.ScriptEngine; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/SpanQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/SpanQueryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/SpanQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/SpanQueryTest.java index fb2530070..c6b436309 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/SpanQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/SpanQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query; +package com.yelp.nrtsearch.server.luceneserver.query; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/MultiFunctionScoreQueryTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/MultiFunctionScoreQueryTest.java similarity index 99% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/MultiFunctionScoreQueryTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/MultiFunctionScoreQueryTest.java index ebf5db847..10a1c5639 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/query/multifunction/MultiFunctionScoreQueryTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/query/multifunction/MultiFunctionScoreQueryTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.search.query.multifunction; +package com.yelp.nrtsearch.server.luceneserver.query.multifunction; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/script/ScoreScriptTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/script/ScoreScriptTest.java index 694684754..af2603993 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/script/ScoreScriptTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/script/ScoreScriptTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.fail; import com.google.common.primitives.Floats; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.AddDocumentResponse; import com.yelp.nrtsearch.server.grpc.FunctionScoreQuery; @@ -42,6 +41,7 @@ import com.yelp.nrtsearch.server.luceneserver.geo.GeoPoint; import com.yelp.nrtsearch.server.plugins.Plugin; import com.yelp.nrtsearch.server.plugins.ScriptPlugin; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.testing.GrpcCleanupRule; import io.prometheus.metrics.model.registry.PrometheusRegistry; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/GlobalOrdinalLookupTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/GlobalOrdinalLookupTest.java index 125fe563b..bbcc8959e 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/GlobalOrdinalLookupTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/GlobalOrdinalLookupTest.java @@ -24,11 +24,11 @@ import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.FieldDefRequest; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; -import com.yelp.nrtsearch.server.luceneserver.ShardState; import com.yelp.nrtsearch.server.luceneserver.field.FieldDef; import com.yelp.nrtsearch.server.luceneserver.field.properties.GlobalOrdinalable; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.util.stream.Stream; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcherTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcherTest.java similarity index 92% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcherTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcherTest.java index 96361c865..dc03f5628 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcherTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcherTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.search; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; @@ -22,7 +22,10 @@ import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.FieldDefRequest; import com.yelp.nrtsearch.server.grpc.LiveSettingsRequest; -import com.yelp.nrtsearch.server.luceneserver.MyIndexSearcher.ExecutorWithParams; +import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.search.MyIndexSearcher.ExecutorWithParams; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.util.ArrayList; @@ -129,7 +132,8 @@ public void testHasSliceParams() throws IOException { private void assertSliceParams(String index, int maxDocs, int maxSegments) throws IOException { SearcherAndTaxonomy s = null; - ShardState shardState = getGlobalState().getIndex(index).getShard(0); + IndexState indexState = getGlobalState().getIndex(index); + ShardState shardState = indexState.getShard(0); try { s = shardState.acquire(); assertTrue(s.searcher instanceof MyIndexSearcher); @@ -137,7 +141,7 @@ private void assertSliceParams(String index, int maxDocs, int maxSegments) throw assertTrue(searcher.getExecutor() instanceof MyIndexSearcher.ExecutorWithParams); MyIndexSearcher.ExecutorWithParams params = (MyIndexSearcher.ExecutorWithParams) searcher.getExecutor(); - assertSame(shardState.searchExecutor, params.wrapped); + assertSame(indexState.getSearchThreadPoolExecutor(), params.wrapped); assertEquals(maxDocs, params.sliceMaxDocs); assertEquals(maxSegments, params.sliceMaxSegments); } finally { diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcherVirtualShardsTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcherVirtualShardsTest.java similarity index 97% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcherVirtualShardsTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcherVirtualShardsTest.java index e26569bd6..8c968a2ce 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/MyIndexSearcherVirtualShardsTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/MyIndexSearcherVirtualShardsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.search; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -22,6 +22,8 @@ import com.yelp.nrtsearch.server.grpc.AddDocumentRequest; import com.yelp.nrtsearch.server.grpc.FieldDefRequest; import com.yelp.nrtsearch.server.grpc.IndexLiveSettings; +import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.util.ArrayList; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/TerminateAfterWrapperTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/TerminateAfterWrapperTest.java index 5c4eb6153..7254b1fd9 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/TerminateAfterWrapperTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/TerminateAfterWrapperTest.java @@ -25,8 +25,8 @@ import com.yelp.nrtsearch.server.grpc.IndexLiveSettings; import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import java.util.ArrayList; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollectorTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollectorTest.java index b1f2a398e..34e4581a7 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollectorTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/DocCollectorTest.java @@ -24,7 +24,7 @@ import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.SearchResponse.Hit.Builder; import com.yelp.nrtsearch.server.grpc.SearchResponse.SearchState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.search.SearchCollectorManager; import com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper; import com.yelp.nrtsearch.server.luceneserver.search.SearchStatsWrapper; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/TermsCollectorManagerTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/TermsCollectorManagerTest.java index 9e248d589..ed61068ff 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/TermsCollectorManagerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/search/collectors/additional/TermsCollectorManagerTest.java @@ -22,9 +22,9 @@ import com.yelp.nrtsearch.server.grpc.FieldDefRequest; import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.TermsCollector; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.ServerTestCase; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.search.collectors.CollectorCreatorContext; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalStateTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalStateTest.java index 453efc6e2..40a370368 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalStateTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/BackendGlobalStateTest.java @@ -37,10 +37,11 @@ import com.yelp.nrtsearch.server.grpc.ReplicationServerClient; import com.yelp.nrtsearch.server.grpc.StartIndexRequest; import com.yelp.nrtsearch.server.grpc.StopIndexRequest; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.concurrent.ThreadPoolExecutorFactory; import com.yelp.nrtsearch.server.luceneserver.field.FieldDefCreator; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.luceneserver.index.IndexStateManager; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; import com.yelp.nrtsearch.server.luceneserver.nrt.NrtDataManager; import com.yelp.nrtsearch.server.luceneserver.similarity.SimilarityCreator; import com.yelp.nrtsearch.server.luceneserver.state.backend.LocalStateBackend; @@ -48,7 +49,6 @@ import com.yelp.nrtsearch.server.luceneserver.state.backend.StateBackend; import com.yelp.nrtsearch.server.plugins.Plugin; import com.yelp.nrtsearch.server.remote.RemoteBackend; -import com.yelp.nrtsearch.server.utils.ThreadPoolExecutorFactory; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.file.Path; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/GlobalStateTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/GlobalStateTest.java similarity index 94% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/GlobalStateTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/state/GlobalStateTest.java index c457fd80c..7206bcb75 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/GlobalStateTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/GlobalStateTest.java @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver; +package com.yelp.nrtsearch.server.luceneserver.state; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; -import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; import java.io.ByteArrayInputStream; import java.io.IOException; import org.junit.Rule; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackendTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackendTest.java index e22af2d15..e72eeb910 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackendTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/LocalStateBackendTest.java @@ -36,8 +36,8 @@ import com.yelp.nrtsearch.server.grpc.IndexStateInfo; import com.yelp.nrtsearch.server.grpc.SortFields; import com.yelp.nrtsearch.server.grpc.SortType; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackendTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackendTest.java index c13f0c764..714a08688 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackendTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/state/backend/RemoteStateBackendTest.java @@ -37,8 +37,8 @@ import com.yelp.nrtsearch.server.grpc.IndexStateInfo; import com.yelp.nrtsearch.server.grpc.SortFields; import com.yelp.nrtsearch.server.grpc.SortType; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import com.yelp.nrtsearch.server.luceneserver.state.StateUtils; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/doc/VectorTypeTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/vector/FloatVectorTypeTest.java similarity index 79% rename from src/test/java/com/yelp/nrtsearch/server/luceneserver/doc/VectorTypeTest.java rename to src/test/java/com/yelp/nrtsearch/server/luceneserver/vector/FloatVectorTypeTest.java index 34a901141..6d7d23e30 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/doc/VectorTypeTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/vector/FloatVectorTypeTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server.luceneserver.doc; +package com.yelp.nrtsearch.server.luceneserver.vector; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -21,7 +21,7 @@ import org.junit.Assert; import org.junit.Test; -public class VectorTypeTest { +public class FloatVectorTypeTest { private static final int INITIAL_CAPACITY = 5; private static final int DEFAULT_CAPACITY = 10; @@ -30,22 +30,22 @@ public class VectorTypeTest { /** Test VectorType constructors and size() methods */ @Test public void vectorTypeConstructorTest() { - VectorType vector = new VectorType(TEST_ARRAY); + FloatVectorType vector = new FloatVectorType(TEST_ARRAY); assertEquals(TEST_ARRAY.length, vector.size()); - VectorType vectorWithCapacity = new VectorType(INITIAL_CAPACITY); + FloatVectorType vectorWithCapacity = new FloatVectorType(INITIAL_CAPACITY); assertEquals(INITIAL_CAPACITY, vectorWithCapacity.size()); } @Test public void getTest() { - VectorType vector = new VectorType(TEST_ARRAY); + FloatVectorType vector = new FloatVectorType(TEST_ARRAY); assertEquals(2.5f, vector.get(1), Math.ulp(2.5f)); } @Test public void setTest() { - VectorType vectorWithCapacity = new VectorType(INITIAL_CAPACITY); + FloatVectorType vectorWithCapacity = new FloatVectorType(INITIAL_CAPACITY); int index = 2; float newValue = 2.5f; float oldValue = vectorWithCapacity.set(index, newValue); @@ -55,21 +55,21 @@ public void setTest() { @Test public void getVectorDataTest() { - VectorType vector = new VectorType(TEST_ARRAY); + FloatVectorType vector = new FloatVectorType(TEST_ARRAY); assertEquals(TEST_ARRAY, vector.getVectorData()); } @Test public void vectorTypeExceptionTest() { Exception capacityException = - Assert.assertThrows(IllegalArgumentException.class, () -> new VectorType(-2)); + Assert.assertThrows(IllegalArgumentException.class, () -> new FloatVectorType(-2)); assertTrue(capacityException.getMessage().contains("vector capacity should be >= 0")); Exception illegalIndexException = Assert.assertThrows( IndexOutOfBoundsException.class, () -> { - VectorType vector = new VectorType(INITIAL_CAPACITY); + FloatVectorType vector = new FloatVectorType(INITIAL_CAPACITY); vector.set(10, 1.0f); }); assertTrue( diff --git a/src/test/java/com/yelp/nrtsearch/server/luceneserver/warming/WarmerTest.java b/src/test/java/com/yelp/nrtsearch/server/luceneserver/warming/WarmerTest.java index 13fcf0e8b..6b0d18644 100644 --- a/src/test/java/com/yelp/nrtsearch/server/luceneserver/warming/WarmerTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/luceneserver/warming/WarmerTest.java @@ -25,8 +25,8 @@ import com.yelp.nrtsearch.server.grpc.Query; import com.yelp.nrtsearch.server.grpc.SearchRequest; import com.yelp.nrtsearch.server.grpc.TermQuery; -import com.yelp.nrtsearch.server.luceneserver.IndexState; import com.yelp.nrtsearch.server.luceneserver.handler.SearchHandler; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.s3.S3Backend; import com.yelp.nrtsearch.test_utils.AmazonS3Provider; diff --git a/src/test/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollectorTest.java b/src/test/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollectorTest.java index 0eb80d6f8..29575a256 100644 --- a/src/test/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollectorTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/monitoring/DirSizeCollectorTest.java @@ -22,7 +22,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.prometheus.metrics.model.snapshots.DataPointSnapshot; import io.prometheus.metrics.model.snapshots.GaugeSnapshot; import io.prometheus.metrics.model.snapshots.Labels; diff --git a/src/test/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollectorTest.java b/src/test/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollectorTest.java index 015f4a223..0c74ff7be 100644 --- a/src/test/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollectorTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/monitoring/MergeSchedulerCollectorTest.java @@ -21,9 +21,9 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; -import com.yelp.nrtsearch.server.luceneserver.ShardState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.ShardState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.prometheus.metrics.model.snapshots.GaugeSnapshot; import io.prometheus.metrics.model.snapshots.MetricSnapshot; import io.prometheus.metrics.model.snapshots.MetricSnapshots; diff --git a/src/test/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollectorTest.java b/src/test/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollectorTest.java index 0206579fc..db946c3b2 100644 --- a/src/test/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollectorTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/monitoring/SearchResponseCollectorTest.java @@ -22,8 +22,8 @@ import com.yelp.nrtsearch.server.grpc.SearchResponse; import com.yelp.nrtsearch.server.grpc.SearchResponse.Diagnostics; import com.yelp.nrtsearch.server.grpc.TotalHits; -import com.yelp.nrtsearch.server.luceneserver.GlobalState; -import com.yelp.nrtsearch.server.luceneserver.IndexState; +import com.yelp.nrtsearch.server.luceneserver.index.IndexState; +import com.yelp.nrtsearch.server.luceneserver.state.GlobalState; import io.prometheus.metrics.model.snapshots.MetricSnapshot; import io.prometheus.metrics.model.snapshots.MetricSnapshots; import java.io.IOException; diff --git a/src/test/java/com/yelp/nrtsearch/server/remote/s3/S3BackendTest.java b/src/test/java/com/yelp/nrtsearch/server/remote/s3/S3BackendTest.java index 094d3b450..233a630ec 100644 --- a/src/test/java/com/yelp/nrtsearch/server/remote/s3/S3BackendTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/remote/s3/S3BackendTest.java @@ -33,7 +33,7 @@ import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteBackend.IndexResourceType; import com.yelp.nrtsearch.server.remote.RemoteUtils; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import com.yelp.nrtsearch.test_utils.AmazonS3Provider; import java.io.ByteArrayInputStream; import java.io.File; @@ -285,7 +285,7 @@ private void assertGlobalStateVersion(String globalStateVersion) { String[] splits = globalStateVersion.split("-", 2); assertEquals(2, splits.length); // check parsable - assertTrue(TimeStringUtil.isTimeStringSec(splits[0])); + assertTrue(TimeStringUtils.isTimeStringSec(splits[0])); UUID.fromString(splits[1]); } @@ -436,7 +436,7 @@ private void assertIndexStateVersion(String indexStateVersion) { String[] splits = indexStateVersion.split("-", 2); assertEquals(2, splits.length); // check parsable - assertTrue(TimeStringUtil.isTimeStringSec(splits[0])); + assertTrue(TimeStringUtils.isTimeStringSec(splits[0])); UUID.fromString(splits[1]); } @@ -587,7 +587,7 @@ private void assertWarmingVersion(String warmingVersion) { String[] splits = warmingVersion.split("-", 2); assertEquals(2, splits.length); // check parsable - assertTrue(TimeStringUtil.isTimeStringSec(splits[0])); + assertTrue(TimeStringUtils.isTimeStringSec(splits[0])); UUID.fromString(splits[1]); } @@ -791,7 +791,7 @@ public void testGetPointStateFileName() { String fileName = S3Backend.getPointStateFileName(pointState); String[] components = fileName.split("-"); assertEquals(3, components.length); - assertTrue(TimeStringUtil.isTimeStringSec(components[0])); + assertTrue(TimeStringUtils.isTimeStringSec(components[0])); assertEquals("primaryId", components[1]); assertEquals("1", components[2]); } diff --git a/src/test/java/com/yelp/nrtsearch/server/utils/FileUtilTest.java b/src/test/java/com/yelp/nrtsearch/server/utils/FileUtilsTest.java similarity index 84% rename from src/test/java/com/yelp/nrtsearch/server/utils/FileUtilTest.java rename to src/test/java/com/yelp/nrtsearch/server/utils/FileUtilsTest.java index 2894c1843..d94d5cfec 100644 --- a/src/test/java/com/yelp/nrtsearch/server/utils/FileUtilTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/utils/FileUtilsTest.java @@ -22,18 +22,18 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; -public class FileUtilTest { +public class FileUtilsTest { @Rule public final TemporaryFolder folder = new TemporaryFolder(); @Test public void testDeleteAllFilesInDir_notExist() throws IOException { - FileUtil.deleteAllFilesInDir(folder.getRoot().toPath().resolve("notExist")); + FileUtils.deleteAllFilesInDir(folder.getRoot().toPath().resolve("notExist")); } @Test public void testDeleteAllFilesInDir_notDir() throws IOException { folder.newFile("file"); - FileUtil.deleteAllFilesInDir(folder.getRoot().toPath().resolve("file")); + FileUtils.deleteAllFilesInDir(folder.getRoot().toPath().resolve("file")); } @Test @@ -42,7 +42,7 @@ public void testDeleteAllFilesInDir() throws IOException { folder.newFile("file2"); folder.newFolder("folder1"); folder.newFolder("folder1/folder2"); - FileUtil.deleteAllFilesInDir(folder.getRoot().toPath()); + FileUtils.deleteAllFilesInDir(folder.getRoot().toPath()); assertArrayEquals(new String[] {}, folder.getRoot().list()); } } diff --git a/src/test/java/com/yelp/nrtsearch/server/LuceneServerTestConfigurationFactory.java b/src/test/java/com/yelp/nrtsearch/server/utils/LuceneServerTestConfigurationFactory.java similarity index 98% rename from src/test/java/com/yelp/nrtsearch/server/LuceneServerTestConfigurationFactory.java rename to src/test/java/com/yelp/nrtsearch/server/utils/LuceneServerTestConfigurationFactory.java index 05394d40e..5ca8f6a3d 100644 --- a/src/test/java/com/yelp/nrtsearch/server/LuceneServerTestConfigurationFactory.java +++ b/src/test/java/com/yelp/nrtsearch/server/utils/LuceneServerTestConfigurationFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yelp.nrtsearch.server; +package com.yelp.nrtsearch.server.utils; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.Mode; diff --git a/src/test/java/com/yelp/nrtsearch/server/utils/TimeStringUtilTest.java b/src/test/java/com/yelp/nrtsearch/server/utils/TimeStringUtilsTest.java similarity index 57% rename from src/test/java/com/yelp/nrtsearch/server/utils/TimeStringUtilTest.java rename to src/test/java/com/yelp/nrtsearch/server/utils/TimeStringUtilsTest.java index 8df5ff33c..49491c2b9 100644 --- a/src/test/java/com/yelp/nrtsearch/server/utils/TimeStringUtilTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/utils/TimeStringUtilsTest.java @@ -23,14 +23,14 @@ import org.junit.Test; import org.mockito.MockedStatic; -public class TimeStringUtilTest { +public class TimeStringUtilsTest { @Test public void testGenerateTimeStringMs() { LocalDateTime mockTime = LocalDateTime.of(2024, 8, 20, 12, 34, 56, 789000000); try (MockedStatic mockLocalDateTime = mockStatic(LocalDateTime.class)) { mockLocalDateTime.when(() -> LocalDateTime.now(ZoneId.of("UTC"))).thenReturn(mockTime); - String timeString = TimeStringUtil.generateTimeStringMs(); + String timeString = TimeStringUtils.generateTimeStringMs(); assertEquals("20240820123456789", timeString); } } @@ -40,50 +40,50 @@ public void testGenerateTimeStringSec() { LocalDateTime mockTime = LocalDateTime.of(2024, 8, 20, 12, 34, 56, 789000000); try (MockedStatic mockLocalDateTime = mockStatic(LocalDateTime.class)) { mockLocalDateTime.when(() -> LocalDateTime.now(ZoneId.of("UTC"))).thenReturn(mockTime); - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); assertEquals("20240820123456", timeString); } } @Test public void testIsTimeStringMs() { - assertTrue(TimeStringUtil.isTimeStringMs("20240820123456789")); - assertTrue(TimeStringUtil.isTimeStringMs("19701010000000000")); - assertTrue(TimeStringUtil.isTimeStringMs("20391229233759999")); + assertTrue(TimeStringUtils.isTimeStringMs("20240820123456789")); + assertTrue(TimeStringUtils.isTimeStringMs("19701010000000000")); + assertTrue(TimeStringUtils.isTimeStringMs("20391229233759999")); - assertFalse(TimeStringUtil.isTimeStringMs("20391229233759")); - assertFalse(TimeStringUtil.isTimeStringMs("20241329233759999")); - assertFalse(TimeStringUtil.isTimeStringMs("20241232233759999")); - assertFalse(TimeStringUtil.isTimeStringMs("20241231243759999")); - assertFalse(TimeStringUtil.isTimeStringMs("09d9c9e4-483e-4a90-9c4F-D342c8da1210")); - assertFalse(TimeStringUtil.isTimeStringMs("09d9c9e4-483e-4a90-D342c8da1210")); - assertFalse(TimeStringUtil.isTimeStringMs("other_file")); - assertFalse(TimeStringUtil.isTimeStringMs("_3.cfs")); - assertFalse(TimeStringUtil.isTimeStringMs("segments")); + assertFalse(TimeStringUtils.isTimeStringMs("20391229233759")); + assertFalse(TimeStringUtils.isTimeStringMs("20241329233759999")); + assertFalse(TimeStringUtils.isTimeStringMs("20241232233759999")); + assertFalse(TimeStringUtils.isTimeStringMs("20241231243759999")); + assertFalse(TimeStringUtils.isTimeStringMs("09d9c9e4-483e-4a90-9c4F-D342c8da1210")); + assertFalse(TimeStringUtils.isTimeStringMs("09d9c9e4-483e-4a90-D342c8da1210")); + assertFalse(TimeStringUtils.isTimeStringMs("other_file")); + assertFalse(TimeStringUtils.isTimeStringMs("_3.cfs")); + assertFalse(TimeStringUtils.isTimeStringMs("segments")); } @Test public void testIsTimeStringSec() { - assertTrue(TimeStringUtil.isTimeStringSec("20240820123456")); - assertTrue(TimeStringUtil.isTimeStringSec("19701010000000")); - assertTrue(TimeStringUtil.isTimeStringSec("20391229233759")); + assertTrue(TimeStringUtils.isTimeStringSec("20240820123456")); + assertTrue(TimeStringUtils.isTimeStringSec("19701010000000")); + assertTrue(TimeStringUtils.isTimeStringSec("20391229233759")); - assertFalse(TimeStringUtil.isTimeStringSec("20391229233759000")); - assertFalse(TimeStringUtil.isTimeStringSec("20241329233759")); - assertFalse(TimeStringUtil.isTimeStringSec("20241232233759")); - assertFalse(TimeStringUtil.isTimeStringSec("20241231243759")); - assertFalse(TimeStringUtil.isTimeStringSec("09d9c9e4-483e-4a90-9c4F-D342c8da1210")); - assertFalse(TimeStringUtil.isTimeStringSec("09d9c9e4-483e-4a90-D342c8da1210")); - assertFalse(TimeStringUtil.isTimeStringSec("other_file")); - assertFalse(TimeStringUtil.isTimeStringSec("_3.cfs")); - assertFalse(TimeStringUtil.isTimeStringSec("segments")); + assertFalse(TimeStringUtils.isTimeStringSec("20391229233759000")); + assertFalse(TimeStringUtils.isTimeStringSec("20241329233759")); + assertFalse(TimeStringUtils.isTimeStringSec("20241232233759")); + assertFalse(TimeStringUtils.isTimeStringSec("20241231243759")); + assertFalse(TimeStringUtils.isTimeStringSec("09d9c9e4-483e-4a90-9c4F-D342c8da1210")); + assertFalse(TimeStringUtils.isTimeStringSec("09d9c9e4-483e-4a90-D342c8da1210")); + assertFalse(TimeStringUtils.isTimeStringSec("other_file")); + assertFalse(TimeStringUtils.isTimeStringSec("_3.cfs")); + assertFalse(TimeStringUtils.isTimeStringSec("segments")); } @Test public void testFormatTimeStringMs() { LocalDateTime localDateTime = LocalDateTime.of(2024, 8, 20, 12, 34, 56, 789000000); String timeString = - TimeStringUtil.formatTimeStringMs(localDateTime.atZone(ZoneId.of("UTC")).toInstant()); + TimeStringUtils.formatTimeStringMs(localDateTime.atZone(ZoneId.of("UTC")).toInstant()); assertEquals("20240820123456789", timeString); } @@ -91,7 +91,7 @@ public void testFormatTimeStringMs() { public void testFormatTimeStringSec() { LocalDateTime localDateTime = LocalDateTime.of(2024, 8, 20, 12, 34, 56, 789000000); String timeString = - TimeStringUtil.formatTimeStringSec(localDateTime.atZone(ZoneId.of("UTC")).toInstant()); + TimeStringUtils.formatTimeStringSec(localDateTime.atZone(ZoneId.of("UTC")).toInstant()); assertEquals("20240820123456", timeString); } @@ -101,7 +101,7 @@ public void testParseTimeStringMs() { String timeString = "20240820123456789"; assertEquals( localDateTime.atZone(ZoneId.of("UTC")).toInstant(), - TimeStringUtil.parseTimeStringMs(timeString)); + TimeStringUtils.parseTimeStringMs(timeString)); } @Test @@ -110,6 +110,6 @@ public void testParseTimeStringSec() { String timeString = "20240820123456"; assertEquals( localDateTime.atZone(ZoneId.of("UTC")).toInstant(), - TimeStringUtil.parseTimeStringSec(timeString)); + TimeStringUtils.parseTimeStringSec(timeString)); } } diff --git a/src/test/java/com/yelp/nrtsearch/server/utils/ZipUtilTest.java b/src/test/java/com/yelp/nrtsearch/server/utils/ZipUtilsTest.java similarity index 93% rename from src/test/java/com/yelp/nrtsearch/server/utils/ZipUtilTest.java rename to src/test/java/com/yelp/nrtsearch/server/utils/ZipUtilsTest.java index 2cc505ec1..d64cfd15e 100644 --- a/src/test/java/com/yelp/nrtsearch/server/utils/ZipUtilTest.java +++ b/src/test/java/com/yelp/nrtsearch/server/utils/ZipUtilsTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; -public class ZipUtilTest { +public class ZipUtilsTest { @Rule public final TemporaryFolder folder = new TemporaryFolder(); @@ -49,7 +49,7 @@ public void setup() throws IOException { public void testUnzip() throws IOException { try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("util/test_zip.zip")) { - List actualExtractedFiles = ZipUtil.extractZip(inputStream, extractDirectory, true); + List actualExtractedFiles = ZipUtils.extractZip(inputStream, extractDirectory, true); assertFalse(Files.exists(extractDirectory.resolve("tmp.zip"))); @@ -85,7 +85,7 @@ public void testUnzip() throws IOException { public void testUnzipPlugin() throws IOException { try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("util/example-plugin-0.0.1.zip")) { - List extractedFiles = ZipUtil.extractZip(inputStream, extractDirectory, false); + List extractedFiles = ZipUtils.extractZip(inputStream, extractDirectory, false); assertEquals(extractedFiles.get(0), "example-plugin-0.0.1/"); } } diff --git a/src/test/java/com/yelp/nrtsearch/tools/cli/ReadyCommandTest.java b/src/test/java/com/yelp/nrtsearch/tools/cli/ReadyCommandTest.java index da50029b4..474ec4314 100644 --- a/src/test/java/com/yelp/nrtsearch/tools/cli/ReadyCommandTest.java +++ b/src/test/java/com/yelp/nrtsearch/tools/cli/ReadyCommandTest.java @@ -17,12 +17,12 @@ import static org.junit.Assert.assertEquals; -import com.yelp.nrtsearch.server.LuceneServerTestConfigurationFactory; import com.yelp.nrtsearch.server.config.LuceneServerConfiguration; import com.yelp.nrtsearch.server.grpc.CreateIndexRequest; import com.yelp.nrtsearch.server.grpc.GrpcServer; import com.yelp.nrtsearch.server.grpc.Mode; import com.yelp.nrtsearch.server.grpc.StartIndexRequest; +import com.yelp.nrtsearch.server.utils.LuceneServerTestConfigurationFactory; import io.grpc.testing.GrpcCleanupRule; import java.io.IOException; import org.junit.After; diff --git a/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommandTest.java b/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommandTest.java index 71e7d93c2..f16bb3d52 100644 --- a/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommandTest.java +++ b/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/CleanupSnapshotsCommandTest.java @@ -25,7 +25,7 @@ import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3Client; import com.yelp.nrtsearch.server.grpc.TestServer; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -116,7 +116,7 @@ private void createSnapshotFiles( for (TestSnapshotInfo snapshotInfo : snapshotInfos) { String timeString = - TimeStringUtil.formatTimeStringMs(Instant.ofEpochMilli(snapshotInfo.timestampMs)); + TimeStringUtils.formatTimeStringMs(Instant.ofEpochMilli(snapshotInfo.timestampMs)); if (snapshotInfo.hasMetadata) { Path metadataFile = metadataRootFolder.resolve(timeString); Files.createFile(metadataFile); @@ -156,7 +156,7 @@ private Path getIndexSnapshotDataRoot(String indexUniqueName, String serviceName @Test public void testDeleteSnapshots() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName); CommandLine cmd = getInjectedCommand(); @@ -177,7 +177,7 @@ public void testDeleteSnapshots() throws IOException { @Test public void testDeleteSnapshotsDryRun() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName); CommandLine cmd = getInjectedCommand(); @@ -204,7 +204,7 @@ public void testDeleteSnapshotsDryRun() throws IOException { @Test public void testDeleteSnapshotsDifferentRoot() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName, true, "different_root"); @@ -231,7 +231,7 @@ public void testDeleteSnapshotsDifferentRoot() throws IOException { @Test public void testDeleteSnapshotsKeepsN() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName); CommandLine cmd = getInjectedCommand(); @@ -257,7 +257,7 @@ public void testDeleteSnapshotsKeepsN() throws IOException { @Test public void testDeleteSnapshotsKeepMore() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName); CommandLine cmd = getInjectedCommand(); @@ -284,7 +284,7 @@ public void testDeleteSnapshotsKeepMore() throws IOException { @Test public void testDeleteAllSnapshots() throws IOException, InterruptedException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName); CommandLine cmd = getInjectedCommand(); @@ -306,7 +306,7 @@ public void testDeleteAllSnapshots() throws IOException, InterruptedException { @Test public void testOnlyKeepN() throws IOException, InterruptedException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName); CommandLine cmd = getInjectedCommand(); @@ -328,7 +328,7 @@ public void testOnlyKeepN() throws IOException, InterruptedException { @Test public void testNoData() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); CommandLine cmd = getInjectedCommand(); @@ -348,7 +348,7 @@ public void testNoData() throws IOException { @Test public void testDeleteDataWithoutMetadata() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName, false); CommandLine cmd = getInjectedCommand(); @@ -368,7 +368,7 @@ public void testDeleteDataWithoutMetadata() throws IOException { @Test public void testKeepDataWithoutMetadata() throws IOException { TestServer.initS3(folder); - String indexUniqueName = "test_index-" + TimeStringUtil.generateTimeStringMs(); + String indexUniqueName = "test_index-" + TimeStringUtils.generateTimeStringMs(); List snapshotInfos = createTestSnapshotData(indexUniqueName, false); CommandLine cmd = getInjectedCommand(); @@ -417,14 +417,15 @@ public void verifySnapshots( Stream.of(infos) .collect( Collectors.toMap( - i -> TimeStringUtil.formatTimeStringMs(Instant.ofEpochMilli(i.timestampMs)), + i -> TimeStringUtils.formatTimeStringMs(Instant.ofEpochMilli(i.timestampMs)), i -> i.files)); Set expectedMetadata = new HashSet<>(); Set expectedDataFolders = new HashSet<>(); Set metadataVersions = new HashSet<>(); for (TestSnapshotInfo info : infos) { - String timeString = TimeStringUtil.formatTimeStringMs(Instant.ofEpochMilli(info.timestampMs)); + String timeString = + TimeStringUtils.formatTimeStringMs(Instant.ofEpochMilli(info.timestampMs)); if (info.hasMetadata) { expectedMetadata.add(timeString); } diff --git a/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotRestoreCommandTest.java b/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotRestoreCommandTest.java index a6606be2e..65e99cfa9 100644 --- a/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotRestoreCommandTest.java +++ b/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/backup/SnapshotRestoreCommandTest.java @@ -44,7 +44,7 @@ import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; @@ -221,7 +221,7 @@ public void testRestore() throws IOException { assertEquals(1, timeStrings.size()); String snapshotTimeString = timeStrings.get(0); - String restoreId = TimeStringUtil.generateTimeStringMs(); + String restoreId = TimeStringUtils.generateTimeStringMs(); CommandLine restoreCmd = getInjectedRestoreCommand(); exitCode = restoreCmd.execute( @@ -259,7 +259,7 @@ public void testRestoreDifferentCluster() throws IOException { assertEquals(1, timeStrings.size()); String snapshotTimeString = timeStrings.get(0); - String restoreId = TimeStringUtil.generateTimeStringMs(); + String restoreId = TimeStringUtils.generateTimeStringMs(); CommandLine restoreCmd = getInjectedRestoreCommand(); exitCode = restoreCmd.execute( @@ -298,7 +298,7 @@ public void testRestoreWarmingQueries() throws IOException { assertEquals(1, timeStrings.size()); String snapshotTimeString = timeStrings.get(0); - String restoreId = TimeStringUtil.generateTimeStringMs(); + String restoreId = TimeStringUtils.generateTimeStringMs(); CommandLine restoreCmd = getInjectedRestoreCommand(); exitCode = restoreCmd.execute( @@ -336,7 +336,7 @@ public void testRestoreDocs() throws IOException { assertEquals(1, timeStrings.size()); String snapshotTimeString = timeStrings.get(0); - String restoreId = TimeStringUtil.generateTimeStringMs(); + String restoreId = TimeStringUtils.generateTimeStringMs(); CommandLine restoreCmd = getInjectedRestoreCommand(); exitCode = restoreCmd.execute( diff --git a/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommandTest.java b/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommandTest.java index 0bb4d6e5d..e4d51b86e 100644 --- a/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommandTest.java +++ b/src/test/java/com/yelp/nrtsearch/tools/nrt_utils/cleanup/CleanupDataCommandTest.java @@ -36,7 +36,7 @@ import com.yelp.nrtsearch.server.remote.RemoteBackend; import com.yelp.nrtsearch.server.remote.RemoteUtils; import com.yelp.nrtsearch.server.remote.s3.S3Backend; -import com.yelp.nrtsearch.server.utils.TimeStringUtil; +import com.yelp.nrtsearch.server.utils.TimeStringUtils; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; @@ -269,8 +269,8 @@ private Set getExistingDataFiles(AmazonS3 s3Client, String indexResource @Test public void testValidatePSNameAndGetTimestampMs() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long expectedTimeMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long expectedTimeMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); String testPSName = timeString + "-" + UUID.randomUUID() + "-1"; long actualTimeMs = CleanupDataCommand.validatePSNameAndGetTimestampMs(testPSName); @@ -279,7 +279,7 @@ public void testValidatePSNameAndGetTimestampMs() { @Test public void testValidatePSNameAndGetTimestampMs_invalidStructure() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "-2-1"; try { CleanupDataCommand.validatePSNameAndGetTimestampMs(testPSName); @@ -291,7 +291,7 @@ public void testValidatePSNameAndGetTimestampMs_invalidStructure() { @Test public void testValidatePSNameAndGetTimestampMs_invalidTimeString() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "000-" + UUID.randomUUID() + "-1"; try { CleanupDataCommand.validatePSNameAndGetTimestampMs(testPSName); @@ -303,7 +303,7 @@ public void testValidatePSNameAndGetTimestampMs_invalidTimeString() { @Test public void testValidatePSNameAndGetTimestampMs_invalidUUID() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "-" + "5d65b454-fa30-49-invalid-8e0e5" + "-1"; try { CleanupDataCommand.validatePSNameAndGetTimestampMs(testPSName); @@ -315,7 +315,7 @@ public void testValidatePSNameAndGetTimestampMs_invalidUUID() { @Test public void testValidatePSNameAndGetTimestampMs_invalidVersionNumber() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "-" + UUID.randomUUID() + "-invalid"; try { CleanupDataCommand.validatePSNameAndGetTimestampMs(testPSName); @@ -327,8 +327,8 @@ public void testValidatePSNameAndGetTimestampMs_invalidVersionNumber() { @Test public void testValidateDataNameAndGetTimestampMs() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long expectedTimeMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long expectedTimeMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); String testPSName = timeString + "-" + UUID.randomUUID() + "-_indexFile"; long actualTimeMs = CleanupDataCommand.validateDataNameAndGetTimestampMs(testPSName); @@ -337,7 +337,7 @@ public void testValidateDataNameAndGetTimestampMs() { @Test public void testValidateDataNameAndGetTimestampMs_invalidStructure() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "-2-1"; try { CleanupDataCommand.validateDataNameAndGetTimestampMs(testPSName); @@ -349,7 +349,7 @@ public void testValidateDataNameAndGetTimestampMs_invalidStructure() { @Test public void testValidateDataNameAndGetTimestampMs_invalidTimeString() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "000-" + UUID.randomUUID() + "-_indexFile"; try { CleanupDataCommand.validateDataNameAndGetTimestampMs(testPSName); @@ -361,7 +361,7 @@ public void testValidateDataNameAndGetTimestampMs_invalidTimeString() { @Test public void testValidateDataNameAndGetTimestampMs_invalidUUID() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "-" + "5d65b454-fa30-49-invalid-8e0e5" + "-_indexFile"; try { CleanupDataCommand.validateDataNameAndGetTimestampMs(testPSName); @@ -373,7 +373,7 @@ public void testValidateDataNameAndGetTimestampMs_invalidUUID() { @Test public void testValidateDataNameAndGetTimestampMs_invalidIndexFile() { - String timeString = TimeStringUtil.generateTimeStringSec(); + String timeString = TimeStringUtils.generateTimeStringSec(); String testPSName = timeString + "-" + UUID.randomUUID() + "-invalid"; try { CleanupDataCommand.validateDataNameAndGetTimestampMs(testPSName); @@ -385,8 +385,8 @@ public void testValidateDataNameAndGetTimestampMs_invalidIndexFile() { @Test public void testPointStateDeletionDecider_delete() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.PointStateDeletionDecider decider = new CleanupDataCommand.PointStateDeletionDecider(timestampMs + 1000); @@ -398,8 +398,8 @@ public void testPointStateDeletionDecider_delete() { @Test public void testPointStateDeletionDecider_retainGreaterTimeString() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.PointStateDeletionDecider decider = new CleanupDataCommand.PointStateDeletionDecider(timestampMs - 1000); @@ -411,8 +411,8 @@ public void testPointStateDeletionDecider_retainGreaterTimeString() { @Test public void testPointStateDeletionDecider_retainGreaterTimestamp() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.PointStateDeletionDecider decider = new CleanupDataCommand.PointStateDeletionDecider(timestampMs + 1000); @@ -424,8 +424,8 @@ public void testPointStateDeletionDecider_retainGreaterTimestamp() { @Test public void testPointStateDeletionDecider_retainCurrentVersion() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.PointStateDeletionDecider decider = new CleanupDataCommand.PointStateDeletionDecider(timestampMs); @@ -436,8 +436,8 @@ public void testPointStateDeletionDecider_retainCurrentVersion() { @Test public void testPointStateDeletionDecider_invalidName() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.PointStateDeletionDecider decider = new CleanupDataCommand.PointStateDeletionDecider(timestampMs + 1000); @@ -452,8 +452,8 @@ public void testPointStateDeletionDecider_invalidName() { @Test public void testIndexDataDeletionDecider_delete() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.IndexDataDeletionDecider decider = new CleanupDataCommand.IndexDataDeletionDecider(timestampMs + 1000, Set.of()); @@ -464,8 +464,8 @@ public void testIndexDataDeletionDecider_delete() { @Test public void testIndexDataDeletionDecider_retainActiveFiles() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); String fileName = timeString + "-" + UUID.randomUUID() + "-_indexFile"; CleanupDataCommand.IndexDataDeletionDecider decider = @@ -476,8 +476,8 @@ public void testIndexDataDeletionDecider_retainActiveFiles() { @Test public void testIndexDataDeletionDecider_retainGreaterTimeString() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.IndexDataDeletionDecider decider = new CleanupDataCommand.IndexDataDeletionDecider(timestampMs - 1000, Set.of()); @@ -488,8 +488,8 @@ public void testIndexDataDeletionDecider_retainGreaterTimeString() { @Test public void testIndexDataDeletionDecider_retainGreaterTimestamp() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.IndexDataDeletionDecider decider = new CleanupDataCommand.IndexDataDeletionDecider(timestampMs + 1000, Set.of()); @@ -500,8 +500,8 @@ public void testIndexDataDeletionDecider_retainGreaterTimestamp() { @Test public void testIndexDataDeletionDecider_invalidName() { - String timeString = TimeStringUtil.generateTimeStringSec(); - long timestampMs = TimeStringUtil.parseTimeStringSec(timeString).toEpochMilli(); + String timeString = TimeStringUtils.generateTimeStringSec(); + long timestampMs = TimeStringUtils.parseTimeStringSec(timeString).toEpochMilli(); CleanupDataCommand.IndexDataDeletionDecider decider = new CleanupDataCommand.IndexDataDeletionDecider(timestampMs + 1000, Set.of());