Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="ExtendedDismaxParserBuilder") public interface ExtendedDismaxParserBuilder extends Builder<Parser>
Builder for creating a multi-field Parser
component with specific behaviour.
ExtendedDismaxParserBuilder has several optional attributes:
name.analyzed
, title.analyzed
and content.analyzed
)
Using the ExtendedDismaxParserBuilder 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 ExtendedDismaxParserBuilder to build more instances. Typically like:
Example of how this strategy could be implemented in Velocity:
## Get the builder
#set ($searchFactory = $sitevisionUtils.searchFactory)
#set ($edismaxBuilder = $searchFactory.extendedDismaxParserBuilder)
## Create a Parser
#set ($nameFieldParser = $edismaxBuilder.addQueryField('name.analyzed').build())
## Re-use the builder to create another Parser
#set ($nameAndTitleFieldParser = $edismaxBuilder.addQueryField('title.analyzed').build())
## Re-use the builder to create yet another Parser
#set ($titleAndContentFieldParser = $edismaxBuilder.clearQueryFields().addQueryField('title.analyzed').addQueryField('content.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 'edismax'
An instance of the Sitevision class implementing this interface can be obtained via
SearchFactory.getExtendedDismaxParserBuilder()
.
See SearchFactory
for how to obtain an instance of the SearchFactory
interface.
Modifier and Type | Method and Description |
---|---|
ExtendedDismaxParserBuilder |
addAdditiveBoostFunction(String aAdditiveBoostFunction)
Adds an additive boost function.
|
ExtendedDismaxParserBuilder |
addMultiplicativeBoostFunction(String aMultiplicativeBoostFunction)
Adds a a multiplicative boost function.
|
ExtendedDismaxParserBuilder |
addPhraseField(String aPhraseField)
Adds a phrase field.
|
ExtendedDismaxParserBuilder |
addQueryField(String aQueryField)
Adds a query field.
|
ExtendedDismaxParserBuilder |
addQueryField(String aQueryField,
double aBoostValue)
Adds a query field with a specific boost.
|
Parser |
build()
Creates a Parser component instance using currently specified state/behaviour.
|
ExtendedDismaxParserBuilder |
clearAdditiveBoostFunctions()
Removes all currently specified additive boost functions.
|
ExtendedDismaxParserBuilder |
clearMultiplicativeBoostFunctions()
Removes all currently specified multiplicative boost functions.
|
ExtendedDismaxParserBuilder |
clearPhraseFields()
Removes all currently specified phrase fields.
|
ExtendedDismaxParserBuilder |
clearQueryFields()
Removes all currently specified query fields.
|
ExtendedDismaxParserBuilder |
setBoostQuery(String aBoostQuery)
Sets a boost query.
|
ExtendedDismaxParserBuilder |
setMinimumShouldMatch(String aMinimumShouldMatch)
Sets the minimum should match.
|
ExtendedDismaxParserBuilder |
setTieBreaker(double aTieBreaker)
Sets the tiebreaker.
|
ExtendedDismaxParserBuilder |
setUserFields(String aUserFields)
Sets the user fields.
|
ExtendedDismaxParserBuilder addQueryField(String aQueryField)
Solr note: this is the 'qf' param.
aQueryField
- the name of the query field, a null
or whitespace-only value will be ignoredExtendedDismaxParserBuilder addQueryField(String aQueryField, double aBoostValue)
Solr note: this is the 'qf' param.
aQueryField
- the name of the query field, a null
or whitespace-only value will be ignoredaBoostValue
- the boost value, a negative value will be ignoredExtendedDismaxParserBuilder clearQueryFields()
ExtendedDismaxParserBuilder setTieBreaker(double aTieBreaker)
Solr note: this is the 'tie' param. The value should typically be something much less than 1.
aTieBreaker
- the tiebreakerExtendedDismaxParserBuilder setUserFields(String aUserFields)
Solr note: this is the 'uf' param.
aUserFields
- the user fieldsExtendedDismaxParserBuilder setMinimumShouldMatch(String aMinimumShouldMatch)
Solr note: this is the 'mm' param. A value of 100% corresponds to the AND operator and a value of 0% corresponds to th OR operator.
aMinimumShouldMatch
- the minimum should matchExtendedDismaxParserBuilder addPhraseField(String aPhraseField)
Solr note: this is the 'pf' param.
aPhraseField
- a phrase field, a null
or whitespace-only value will be ignoredExtendedDismaxParserBuilder clearPhraseFields()
ExtendedDismaxParserBuilder setBoostQuery(String aBoostQuery)
Solr note: this is the 'bq' param.
aBoostQuery
- the boost queryExtendedDismaxParserBuilder addAdditiveBoostFunction(String aAdditiveBoostFunction)
Solr note: this is the 'bf' param.
aAdditiveBoostFunction
- an additive boost function, a null
or whitespace-only value will be ignoredExtendedDismaxParserBuilder clearAdditiveBoostFunctions()
ExtendedDismaxParserBuilder addMultiplicativeBoostFunction(String aMultiplicativeBoostFunction)
Solr note: this is the 'boost' param.
aMultiplicativeBoostFunction
- a multiplicative boost function, a null
or whitespace-only value will be ignoredExtendedDismaxParserBuilder clearMultiplicativeBoostFunctions()
Sitevision - 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.