org.apache.lucene.search
Class QueryUtils

java.lang.Object
  extended by org.apache.lucene.search.QueryUtils

public class QueryUtils
extends Object

Copyright 2005 Apache Software Foundation 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.


Constructor Summary
QueryUtils()
           
 
Method Summary
static void check(org.apache.lucene.search.Query q)
          Check the types of things query objects should be able to do.
static void check(Random random, org.apache.lucene.search.Query q1, org.apache.lucene.search.Searcher s)
          Various query sanity checks on a searcher, some checks are only done for instanceof IndexSearcher.
static void checkEqual(org.apache.lucene.search.Query q1, org.apache.lucene.search.Query q2)
           
static void checkExplanations(org.apache.lucene.search.Query q, org.apache.lucene.search.Searcher s)
          deep check that explanations of a query 'score' correctly
static void checkHashEquals(org.apache.lucene.search.Query q)
          check very basic hashCode and equals
static void checkSkipTo(org.apache.lucene.search.Query q, org.apache.lucene.search.IndexSearcher s)
          alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc and ensure a hitcollector receives same docs and scores
static void checkUnequal(org.apache.lucene.search.Query q1, org.apache.lucene.search.Query q2)
           
static org.apache.lucene.search.MultiSearcher wrapSearcher(Random random, org.apache.lucene.search.Searcher s, int edge)
          Given a Searcher, returns a new MultiSearcher wrapping the the original Searcher, as well as several "empty" IndexSearchers -- some of which will have deleted documents in them.
static org.apache.lucene.search.IndexSearcher wrapUnderlyingReader(Random random, org.apache.lucene.search.IndexSearcher s, int edge)
          Given an IndexSearcher, returns a new IndexSearcher whose IndexReader is a MultiReader containing the Reader of the original IndexSearcher, as well as several "empty" IndexReaders -- some of which will have deleted documents in them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryUtils

public QueryUtils()
Method Detail

check

public static void check(org.apache.lucene.search.Query q)
Check the types of things query objects should be able to do.


checkHashEquals

public static void checkHashEquals(org.apache.lucene.search.Query q)
check very basic hashCode and equals


checkEqual

public static void checkEqual(org.apache.lucene.search.Query q1,
                              org.apache.lucene.search.Query q2)

checkUnequal

public static void checkUnequal(org.apache.lucene.search.Query q1,
                                org.apache.lucene.search.Query q2)

checkExplanations

public static void checkExplanations(org.apache.lucene.search.Query q,
                                     org.apache.lucene.search.Searcher s)
                              throws IOException
deep check that explanations of a query 'score' correctly

Throws:
IOException

check

public static void check(Random random,
                         org.apache.lucene.search.Query q1,
                         org.apache.lucene.search.Searcher s)
Various query sanity checks on a searcher, some checks are only done for instanceof IndexSearcher.

See Also:
check(Query), checkFirstSkipTo(org.apache.lucene.search.Query, org.apache.lucene.search.IndexSearcher), checkSkipTo(org.apache.lucene.search.Query, org.apache.lucene.search.IndexSearcher), checkExplanations(org.apache.lucene.search.Query, org.apache.lucene.search.Searcher), checkSerialization(org.apache.lucene.search.Query, org.apache.lucene.search.Searcher), checkEqual(org.apache.lucene.search.Query, org.apache.lucene.search.Query)

wrapUnderlyingReader

public static org.apache.lucene.search.IndexSearcher wrapUnderlyingReader(Random random,
                                                                          org.apache.lucene.search.IndexSearcher s,
                                                                          int edge)
                                                                   throws IOException
Given an IndexSearcher, returns a new IndexSearcher whose IndexReader is a MultiReader containing the Reader of the original IndexSearcher, as well as several "empty" IndexReaders -- some of which will have deleted documents in them. This new IndexSearcher should behave exactly the same as the original IndexSearcher.

Parameters:
s - the searcher to wrap
edge - if negative, s will be the first sub; if 0, s will be in the middle, if positive s will be the last sub
Throws:
IOException

wrapSearcher

public static org.apache.lucene.search.MultiSearcher wrapSearcher(Random random,
                                                                  org.apache.lucene.search.Searcher s,
                                                                  int edge)
                                                           throws IOException
Given a Searcher, returns a new MultiSearcher wrapping the the original Searcher, as well as several "empty" IndexSearchers -- some of which will have deleted documents in them. This new MultiSearcher should behave exactly the same as the original Searcher.

Parameters:
s - the Searcher to wrap
edge - if negative, s will be the first sub; if 0, s will be in hte middle, if positive s will be the last sub
Throws:
IOException

checkSkipTo

public static void checkSkipTo(org.apache.lucene.search.Query q,
                               org.apache.lucene.search.IndexSearcher s)
                        throws IOException
alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc and ensure a hitcollector receives same docs and scores

Throws:
IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.