Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="StandardParserBuilder") public interface StandardParserBuilder extends Builder<Parser>
Builder for creating a single-field Parser component with specific behaviour.
StandardParserBuilder has two optional attributes:
content.analyzed)
Using the StandardParserBuilder is pretty straightforward, if you remember that it is stateful. Conceptually you would typically use it like this:
When you have built a Parser instance, you can re-use the StandardParserBuilder to build more instances. Typically like:
Example of how this strategy could be implemented in Velocity:
## Get the builder
#set ($searchFactory = $sitevisionUtils.searchFactory)
#set ($standardBuilder = $searchFactory.standardParserBuilder)
## Create a Parser
#set ($nameFieldParser = $standardBuilder.setDefaultField('name.analyzed').build())
## Re-use the builder to create another Parser
#set ($titleFieldParser = $standardBuilder.setDefaultField('title.analyzed').build())
Tip! The Builder interface documentation contains
more information about Builders and how to work with them!
Solr note: the defType param for this parser is 'standard' or 'lucene'
An instance of the Sitevision class implementing this interface can be obtained via
SearchFactory.getStandardParserBuilder().
See SearchFactory for how to obtain an instance of the SearchFactory interface.
| Modifier and Type | Method and Description |
|---|---|
Parser |
build()
Creates a Parser component instance using currently specified state/behaviour.
|
StandardParserBuilder |
setDefaultField(String aDefaultField)
Sets the default query field.
|
StandardParserBuilder |
setQueryOperator(String aQueryOperator)
Sets the query operator.
|
StandardParserBuilder setDefaultField(String aDefaultField)
Solr note: this is the 'df' param.
aDefaultField - the name of the query field, null or whitespace-only values will be ignoredStandardParserBuilder setQueryOperator(String aQueryOperator)
Solr note: this is the 'q.op' param. The value should typically be "AND" or "OR".
aQueryOperator - the query operator, all values except [null, "AND", "OR"] will be ignoredSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.