Package org.codelibs.fess.indexer
Class DocBoostMatcher
java.lang.Object
org.codelibs.fess.indexer.DocBoostMatcher
A matcher class for applying document boost values based on configurable expressions.
This class evaluates match and boost expressions against document data to determine
if a document should receive a boost and what boost value to apply. It supports
script-based expressions for flexible document scoring.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor that creates a DocBoostMatcher with default script type.DocBoostMatcher(org.codelibs.fess.opensearch.config.exentity.BoostDocumentRule rule) Constructor that creates a DocBoostMatcher from a BoostDocumentRule. -
Method Summary
Modifier and TypeMethodDescriptionGets the current boost expression.Gets the current match expression.floatCalculates the boost value for the given document data using the boost expression.booleanDetermines if the given document data matches the configured match expression.voidsetBoostExpression(String expression) Sets the boost expression used to calculate boost values.voidsetMatchExpression(String expression) Sets the match expression used to determine if documents should be boosted.
-
Constructor Details
-
DocBoostMatcher
public DocBoostMatcher()Default constructor that creates a DocBoostMatcher with default script type. Uses the default script engine as defined in Constants.DEFAULT_SCRIPT. -
DocBoostMatcher
public DocBoostMatcher(org.codelibs.fess.opensearch.config.exentity.BoostDocumentRule rule) Constructor that creates a DocBoostMatcher from a BoostDocumentRule.- Parameters:
rule- the boost document rule containing match and boost expressions
-
-
Method Details
-
match
Determines if the given document data matches the configured match expression.- Parameters:
map- the document data as a map of field names to values- Returns:
- true if the document matches the expression, false otherwise
-
getValue
Calculates the boost value for the given document data using the boost expression. The method evaluates the boost expression and converts the result to a float value. Supports Integer, Long, Float, Double, and String representations of numbers.- Parameters:
map- the document data as a map of field names to values- Returns:
- the calculated boost value as a float, or 0.0f if evaluation fails
-
getBoostExpression
Gets the current boost expression.- Returns:
- the boost expression string
-
setBoostExpression
Sets the boost expression used to calculate boost values.- Parameters:
expression- the boost expression string
-
getMatchExpression
Gets the current match expression.- Returns:
- the match expression string
-
setMatchExpression
Sets the match expression used to determine if documents should be boosted.- Parameters:
expression- the match expression string
-