Java Code Examples for org.apache.lucene.util.automaton.Operations#DEFAULT_MAX_DETERMINIZED_STATES

The following examples show how to use org.apache.lucene.util.automaton.Operations#DEFAULT_MAX_DETERMINIZED_STATES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimplePatternSplitTokenizer.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** Runs a pre-built automaton. */
public SimplePatternSplitTokenizer(AttributeFactory factory, Automaton dfa) {
  super(factory);

  // we require user to do this up front because it is a possibly very costly operation, and user may be creating us frequently, not
  // realizing this ctor is otherwise trappy
  if (dfa.isDeterministic() == false) {
    throw new IllegalArgumentException("please determinize the incoming automaton first");
  }

  runDFA = new CharacterRunAutomaton(dfa, Operations.DEFAULT_MAX_DETERMINIZED_STATES);
}
 
Example 2
Source File: SimplePatternTokenizer.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** Runs a pre-built automaton. */
public SimplePatternTokenizer(AttributeFactory factory, Automaton dfa) {
  super(factory);

  // we require user to do this up front because it is a possibly very costly operation, and user may be creating us frequently, not
  // realizing this ctor is otherwise trappy
  if (dfa.isDeterministic() == false) {
    throw new IllegalArgumentException("please determinize the incoming automaton first");
  }

  runDFA = new CharacterRunAutomaton(dfa, Operations.DEFAULT_MAX_DETERMINIZED_STATES);
}
 
Example 3
Source File: TestFuzzyQuery.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testErrorMessage() {
  // 45 states per vector from Lev2TParametricDescription
  final int length = (Operations.DEFAULT_MAX_DETERMINIZED_STATES / 45) + 10;
  final String value = randomRealisticMultiByteUnicode(length);

  FuzzyTermsEnum.FuzzyTermsException expected = expectThrows(FuzzyTermsEnum.FuzzyTermsException.class, () -> {
    new FuzzyAutomatonBuilder(value, 2, 0, true).buildMaxEditAutomaton();
  });
  assertThat(expected.getMessage(), containsString(value));

  expected = expectThrows(FuzzyTermsEnum.FuzzyTermsException.class,
      () -> new FuzzyAutomatonBuilder(value, 2, 0, true).buildAutomatonSet());
  assertThat(expected.getMessage(), containsString(value));
}
 
Example 4
Source File: SimplePatternSplitTokenizer.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
/** See {@link RegExp} for the accepted syntax. */
public SimplePatternSplitTokenizer(String regexp) {
  this(DEFAULT_TOKEN_ATTRIBUTE_FACTORY, regexp, Operations.DEFAULT_MAX_DETERMINIZED_STATES);
}
 
Example 5
Source File: SimplePatternTokenizer.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
/** See {@link RegExp} for the accepted syntax. */
public SimplePatternTokenizer(String regexp) {
  this(DEFAULT_TOKEN_ATTRIBUTE_FACTORY, regexp, Operations.DEFAULT_MAX_DETERMINIZED_STATES);
}
 
Example 6
Source File: RegexCompletionQuery.java    From lucene-solr with Apache License 2.0 2 votes vote down vote up
/**
 * Calls {@link RegexCompletionQuery#RegexCompletionQuery(Term, int, int, BitsProducer)}
 * enabling all optional regex syntax and <code>maxDeterminizedStates</code> of
 * {@value Operations#DEFAULT_MAX_DETERMINIZED_STATES}
 */
public RegexCompletionQuery(Term term, BitsProducer filter) {
  this(term, RegExp.ALL, Operations.DEFAULT_MAX_DETERMINIZED_STATES, filter);
}
 
Example 7
Source File: FuzzyCompletionQuery.java    From lucene-solr with Apache License 2.0 2 votes vote down vote up
/**
 * Calls {@link FuzzyCompletionQuery#FuzzyCompletionQuery(Analyzer, Term, BitsProducer,
 * int, boolean, int, int, boolean, int)}
 * with defaults for <code>maxEdits</code>, <code>transpositions</code>,
 * <code>nonFuzzyPrefix</code>, <code>minFuzzyLength</code>,
 * <code>unicodeAware</code> and <code>maxDeterminizedStates</code>
 *
 * See {@link #DEFAULT_MAX_EDITS}, {@link #DEFAULT_TRANSPOSITIONS},
 * {@link #DEFAULT_NON_FUZZY_PREFIX}, {@link #DEFAULT_MIN_FUZZY_LENGTH},
 * {@link #DEFAULT_UNICODE_AWARE} and {@link Operations#DEFAULT_MAX_DETERMINIZED_STATES}
 * for defaults
 */
public FuzzyCompletionQuery(Analyzer analyzer, Term term, BitsProducer filter) {
  this(analyzer, term, filter, DEFAULT_MAX_EDITS, DEFAULT_TRANSPOSITIONS, DEFAULT_NON_FUZZY_PREFIX,
      DEFAULT_MIN_FUZZY_LENGTH, DEFAULT_UNICODE_AWARE, Operations.DEFAULT_MAX_DETERMINIZED_STATES
  );
}
 
Example 8
Source File: AutomatonQuery.java    From lucene-solr with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new AutomatonQuery from an {@link Automaton}.
 * 
 * @param term Term containing field and possibly some pattern structure. The
 *        term text is ignored.
 * @param automaton Automaton to run, terms that are accepted are considered a
 *        match.
 */
public AutomatonQuery(final Term term, Automaton automaton) {
  this(term, automaton, Operations.DEFAULT_MAX_DETERMINIZED_STATES);
}
 
Example 9
Source File: RegexpQuery.java    From lucene-solr with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 */
public RegexpQuery(Term term, int flags) {
  this(term, flags, defaultProvider,
    Operations.DEFAULT_MAX_DETERMINIZED_STATES);
}