no.sesat.search.mode.command.querybuilder
Class BaseFilterBuilder
java.lang.Object
no.sesat.commons.visitor.AbstractReflectionVisitor
no.sesat.search.mode.command.querybuilder.AbstractQueryBuilder
no.sesat.search.mode.command.querybuilder.BaseFilterBuilder
- All Implemented Interfaces:
- no.sesat.commons.visitor.Visitor, FilterBuilder, QueryBuilder
- Direct Known Subclasses:
- FastAdvancedFilterBuilder, FastSimpleFilterBuilder
public class BaseFilterBuilder
- extends AbstractQueryBuilder
- implements FilterBuilder
Visitor to create the filter string.
Extracts filters from the query that have been defined,
in modes.xml//modes/mode/search-command@field-filters,
to be passed through to the backend.
The filter are removed from the QueryBuilder.getQueryString due to the InitialisationQueryTransformer.
For example handles the site: syntax.
The default output uses a colon : to join field to the term, and prefixes the pair with the plus sign +
For example: +site:vg.no
The " +" is defined as the deliminator, and is provided by getDelim() if a subclass wishes to alter just this.
- Version:
- $Id: BaseFilterBuilder.java 7225 2009-04-09 00:32:20Z ssmiweve $
| Fields inherited from class no.sesat.commons.visitor.AbstractReflectionVisitor |
VISIT_METHOD_IMPL |
| Methods inherited from class no.sesat.search.mode.command.querybuilder.AbstractQueryBuilder |
appendToQueryRepresentation, appendToQueryRepresentation, escape, getConfig, getContext, getEscapedTransformedTerm, getQueryRepresentationLength, getQueryString, getWordsToEscape, insertToQueryRepresentation, isNextLeafInsideNotClause, visitImpl |
| Methods inherited from class no.sesat.commons.visitor.AbstractReflectionVisitor |
visit, visitImpl |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface no.sesat.commons.visitor.Visitor |
visit |
BaseFilterBuilder
public BaseFilterBuilder(QueryBuilder.Context cxt,
QueryBuilderConfig config)
addFilter
public void addFilter(String field,
String value)
- Default format is to apend filters like "field:value".
Add a filter. Where field is blank an anonymous filter will be added.
- Specified by:
addFilter in interface FilterBuilder
getFilterString
public String getFilterString()
- Description copied from interface:
FilterBuilder
- The Filter String built from the Query's transformed clauses.
The filter string consists of key-value pairs usually represented key:value.
The Query parser refers to these pairs as fielded clauses.
By default will delegate to getQueyString()
- Specified by:
getFilterString in interface FilterBuilder
- Returns:
- string built from the Query's transformed clauses, or "".
getFilter
public String getFilter(String string)
- Find a particular filter value.
When looking for a matching filter any leading QueryParser.OPERATORS
to field names in the filter string are ignored.
- Specified by:
getFilter in interface FilterBuilder
- Parameters:
string - the filter (or field) name
- Returns:
- the filter's (or field's) value. space separated if multiple values exist.
visitImpl
protected void visitImpl(LeafClause clause)
visitImpl
protected void visitImpl(PhraseClause clause)
visitImpl
protected void visitImpl(BinaryClause clause)
visitImpl
protected void visitImpl(NotClause clause)
visitImpl
protected void visitImpl(AndNotClause clause)
appendFilter
protected void appendFilter(LeafClause clause)
isEmptyLeaf
protected boolean isEmptyLeaf(Clause clause)
- Override logic. Almost an inversion since the QueryBuilder hides fielded filters
and the FilterBuilder includes them.
- Overrides:
isEmptyLeaf in class AbstractQueryBuilder
- Parameters:
clause -
- Returns:
getDelim
protected String getDelim()
Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.