Class LookAheadConstraint
java.lang.Object
io.fluxzero.common.api.search.constraints.PathConstraint
io.fluxzero.common.api.search.constraints.LookAheadConstraint
- All Implemented Interfaces:
Constraint
A constraint that supports search-as-you-type functionality by matching terms or phrases that start with a given
input string.
For example, the input "hat" will match documents containing terms like "hatter" or phrases like
"the cat with the hat".
The constraint delegates matching to an equivalent ContainsConstraint created via Constraint.decompose().
If no paths are provided, the constraint will match across all paths in the document.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConstraintCreates aLookAheadConstraintthat matches any terms or phrases starting with the given input string.booleanEvaluates whether this constraint matches the givenDocument.protected booleanmatches(Document.Entry entry, Document document) Not supported for this constraint type, as this constraint relies on higher-level document decomposition.Methods inherited from class PathConstraint
checkPathBeforeEntry, getPaths, hasPathConstraint, withPathsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Constraint
and, decompose, or
-
Constructor Details
-
LookAheadConstraint
public LookAheadConstraint()
-
-
Method Details
-
lookAhead
Creates aLookAheadConstraintthat matches any terms or phrases starting with the given input string.If the input is blank or
null, this returns aNoOpConstraint.- Parameters:
lookAhead- the search prefixpaths- optional field paths to restrict the search to- Returns:
- a
LookAheadConstraintorNoOpConstraint
-
matches
Evaluates whether this constraint matches the givenDocument. This implementation delegates to the result ofConstraint.decompose().- Specified by:
matchesin interfaceConstraint- Overrides:
matchesin classPathConstraint- Parameters:
document- the document to test- Returns:
trueif the document matches, otherwisefalse
-
matches
Not supported for this constraint type, as this constraint relies on higher-level document decomposition.- Specified by:
matchesin classPathConstraint- Parameters:
entry- the document entry to evaluate- Returns:
trueif the entry satisfies the condition;falseotherwise- Throws:
UnsupportedOperationException- always
-