| dlog4j.search.FieldFilter
FieldFilter | public class FieldFilter extends org.apache.lucene.search.Filter (Code) | | A Filter that restricts search results to Documents that match a set of
specified Field values.
For example, suppose you create a search index to make your catalog of widgets
searchable. When indexing, you add a field to each Document called "color"
that has one of the following values: "blue", "green", "yellow", or "red".
Now suppose that a user is executing a query but only wants to see green
widgets in the results. The following code snippet yields that behavior:
//In this example, we assume the Searcher and Query are already defined.
//Define a FieldFilter to only show green colored widgets.
Field myFilter = new FieldFilter("color", "green");
Hits queryResults = mySearcher.execute(myQuery, myFilter);
author: Matt Tucker (matt@coolservlets.com) |
Method Summary | |
public BitSet | bits(IndexReader reader) |
FieldFilter | public FieldFilter(String field, String[] values)(Code) | | Creates a new field filter. The name of the field and the values to filter
on are specified. In order for a Document to pass this filter, it must:
- The given field must exist in the document.
- The field value in the Document must exactly match one of the
given values.
Parameters: field - the name of the field to filter on. Parameters: values - the possible values of the field that search results mustmatch. |
FieldFilter | public FieldFilter(String field, String value)(Code) | | Creates a new field filter. The name of the field and the value to filter
on are specified. In order for a Document to pass this filter, it must:
- The given field must exist in the document.
- The field value in the Document must exactly match one of the
given values.
Parameters: field - the name of the field to filter on. Parameters: value - the value of the field that search results must match. |
|
|