Class MultipassTermFilteredPresearcher
Incoming documents are then converted to a set of Disjunction queries over each suffixed field, and these queries are combined into a conjunction query, such that the document's set of terms must match a term from each route.
This allows filtering out of documents that contain one half of a two-term phrase query, for
example. The query "hello world"
will be indexed twice, once under 'hello' and once under
'world'. A document containing the terms "hello there" would match the first field, but not the
second, and so would not be selected for matching.
The number of passes the presearcher makes is configurable. More passes will improve the selected/matched ratio, but will take longer to index and will use more RAM.
A minimum weight can we set for terms to be chosen for the second and subsequent passes. This allows users to avoid indexing stopwords, for example.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.monitor.TermFilteredPresearcher
TermFilteredPresearcher.BytesRefHashIterator, TermFilteredPresearcher.DocumentQueryBuilder
-
Field Summary
Fields inherited from class org.apache.lucene.monitor.TermFilteredPresearcher
DEFAULT_WEIGHTOR
Fields inherited from class org.apache.lucene.monitor.Presearcher
NO_FILTERING
-
Constructor Summary
ConstructorDescriptionMultipassTermFilteredPresearcher
(int passes) Construct a new MultipassTermFilteredPresearcher usingTermFilteredPresearcher.DEFAULT_WEIGHTOR
MultipassTermFilteredPresearcher
(int passes, float minWeight, TermWeightor weightor, List<CustomQueryHandler> queryHandlers, Set<String> filterFields) Construct a new MultipassTermFilteredPresearcher -
Method Summary
Modifier and TypeMethodDescriptionbuildQueryDocument
(QueryTree querytree) Builds aDocument
from the terms extracted from a queryReturns aTermFilteredPresearcher.DocumentQueryBuilder
for this presearcherMethods inherited from class org.apache.lucene.monitor.TermFilteredPresearcher
buildQuery, collectTerms, indexQuery
-
Constructor Details
-
MultipassTermFilteredPresearcher
public MultipassTermFilteredPresearcher(int passes, float minWeight, TermWeightor weightor, List<CustomQueryHandler> queryHandlers, Set<String> filterFields) Construct a new MultipassTermFilteredPresearcher- Parameters:
passes
- the number of times a query should be indexedminWeight
- the minimum weight a querytree should be advanced overweightor
- the TreeWeightor to usequeryHandlers
- a list of custom query handlersfilterFields
- a set of fields to use as filters
-
MultipassTermFilteredPresearcher
public MultipassTermFilteredPresearcher(int passes) Construct a new MultipassTermFilteredPresearcher usingTermFilteredPresearcher.DEFAULT_WEIGHTOR
Note that this will be constructed with a minimum advance weight of zero
- Parameters:
passes
- the number of times a query should be indexed
-
-
Method Details
-
getQueryBuilder
Description copied from class:TermFilteredPresearcher
Returns aTermFilteredPresearcher.DocumentQueryBuilder
for this presearcher- Overrides:
getQueryBuilder
in classTermFilteredPresearcher
-
buildQueryDocument
Description copied from class:TermFilteredPresearcher
Builds aDocument
from the terms extracted from a query- Overrides:
buildQueryDocument
in classTermFilteredPresearcher
-