1 package org.apache.lucene.search;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import java.io.IOException;
22 import org.apache.lucene.index.IndexReader;
25 * Provides caching of {@link org.apache.lucene.search.Filter}s themselves on the remote end of an RMI connection.
26 * The cache is keyed on Filter's hashCode(), so if it sees the same filter twice
27 * it will reuse the original version.
29 * NOTE: This does NOT cache the Filter bits, but rather the Filter itself.
30 * Thus, this works hand-in-hand with {@link org.apache.lucene.search.CachingWrapperFilter} to keep both
31 * file Filter cache and the Filter bits on the remote end, close to the searcher.
35 * To cache a result you must do something like
36 * RemoteCachingWrapperFilter f = new RemoteCachingWrapperFilter(new CachingWrapperFilter(myFilter));
39 * @deprecated This package (all of contrib/remote) will be
43 public class RemoteCachingWrapperFilter extends Filter {
44 protected Filter filter;
46 public RemoteCachingWrapperFilter(Filter filter) {
51 * Uses the {@link org.apache.lucene.search.FilterManager} to keep the cache for a filter on the
52 * searcher side of a remote connection.
53 * @param reader the index reader for the Filter
54 * @return the DocIdSet
57 public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
58 Filter cachedFilter = FilterManager.getInstance().getFilter(filter);
59 return cachedFilter.getDocIdSet(reader);