Ejemplo n.º 1
0
 /**
  * Returns true if the term matches the automaton. Also stashes away the term to assist with smart
  * enumeration.
  */
 @Override
 protected AcceptStatus accept(final BytesRef term) {
   if (commonSuffixRef == null || StringHelper.endsWith(term, commonSuffixRef)) {
     if (runAutomaton.run(term.bytes, term.offset, term.length))
       return linear ? AcceptStatus.YES : AcceptStatus.YES_AND_SEEK;
     else
       return (linear && termComp.compare(term, linearUpperBound) < 0)
           ? AcceptStatus.NO
           : AcceptStatus.NO_AND_SEEK;
   } else {
     return (linear && termComp.compare(term, linearUpperBound) < 0)
         ? AcceptStatus.NO
         : AcceptStatus.NO_AND_SEEK;
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns whether the given value is accepted based on the {@code include} &amp; {@code
  * exclude} patterns.
  */
 @Override
 public boolean accept(BytesRef value) {
   return runAutomaton.run(value.bytes, value.offset, value.length);
 }