diff --git a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SsdvReaderStatesManager.java b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SsdvReaderStatesManager.java new file mode 100644 index 00000000000..c169e449905 --- /dev/null +++ b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SsdvReaderStatesManager.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.lucene.facet.sortedset; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.Map; +import java.util.Set; +import org.apache.lucene.facet.FacetsConfig; +import org.apache.lucene.search.IndexSearcher; + +/** + * This class demonstrates how Lucene could help a user build SSDV ordinal maps eagerly, on refresh. + * This class offers: + * + *
1. A centralized store of SSDV reader states. + * + *
2. A method to rebuild all reader states the user needs.
+ */
+public class SsdvReaderStatesManager {
+ /**
+ * The only attribute is a mapping of SSDV fields to reader states. Each reader state will be a
+ * {@link DefaultSortedSetDocValuesReaderState} with an ordinal map for one of the fields.
+ */
+ private Map