Class LookAheadConstraint
java.lang.Object
io.fluxcapacitor.common.api.search.constraints.PathConstraint
io.fluxcapacitor.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 Constraint
Creates aLookAheadConstraint
that matches any terms or phrases starting with the given input string.boolean
Evaluates whether this constraint matches the givenDocument
.protected boolean
matches
(Document.Entry entry) Not supported for this constraint type, as this constraint relies on higher-level document decomposition.Methods inherited from class io.fluxcapacitor.common.api.search.constraints.PathConstraint
checkPathBeforeEntry, getPaths, hasPathConstraint, withPaths
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.api.search.Constraint
and, decompose, or
-
Constructor Details
-
LookAheadConstraint
public LookAheadConstraint()
-
-
Method Details
-
lookAhead
Creates aLookAheadConstraint
that 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
LookAheadConstraint
orNoOpConstraint
-
matches
Evaluates whether this constraint matches the givenDocument
. This implementation delegates to the result ofConstraint.decompose()
.- Specified by:
matches
in interfaceConstraint
- Overrides:
matches
in classPathConstraint
- Parameters:
document
- the document to test- Returns:
true
if the document matches, otherwisefalse
-
matches
Not supported for this constraint type, as this constraint relies on higher-level document decomposition.- Specified by:
matches
in classPathConstraint
- Parameters:
entry
- the document entry to evaluate- Returns:
true
if the entry satisfies the condition;false
otherwise- Throws:
UnsupportedOperationException
- always
-