Java 类org.apache.lucene.util.automaton.AutomatonProvider 实例源码

项目:search    文件:TestRegexpQuery.java   
public void testCustomProvider() throws IOException {
  AutomatonProvider myProvider = new AutomatonProvider() {
    // automaton that matches quick or brown
    private Automaton quickBrownAutomaton = Operations.union(Arrays
        .asList(Automata.makeString("quick"),
        Automata.makeString("brown"),
        Automata.makeString("bob")));

    @Override
    public Automaton getAutomaton(String name) {
      if (name.equals("quickBrown")) return quickBrownAutomaton;
      else return null;
    }
  };
  RegexpQuery query = new RegexpQuery(newTerm("<quickBrown>"), RegExp.ALL,
    myProvider, DEFAULT_MAX_DETERMINIZED_STATES);
  assertEquals(1, searcher.search(query, 5).totalHits);
}
项目:NYBC    文件:TestRegexpQuery.java   
public void testCustomProvider() throws IOException {
  AutomatonProvider myProvider = new AutomatonProvider() {
    // automaton that matches quick or brown
    private Automaton quickBrownAutomaton = BasicOperations.union(Arrays
        .asList(BasicAutomata.makeString("quick"),
        BasicAutomata.makeString("brown"),
        BasicAutomata.makeString("bob")));

    @Override
    public Automaton getAutomaton(String name) {
      if (name.equals("quickBrown")) return quickBrownAutomaton;
      else return null;
    }
  };
  RegexpQuery query = new RegexpQuery(newTerm("<quickBrown>"), RegExp.ALL,
      myProvider);
  assertEquals(1, searcher.search(query, 5).totalHits);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestRegexpQuery.java   
public void testCustomProvider() throws IOException {
  AutomatonProvider myProvider = new AutomatonProvider() {
    // automaton that matches quick or brown
    private Automaton quickBrownAutomaton = BasicOperations.union(Arrays
        .asList(BasicAutomata.makeString("quick"),
        BasicAutomata.makeString("brown"),
        BasicAutomata.makeString("bob")));

    @Override
    public Automaton getAutomaton(String name) {
      if (name.equals("quickBrown")) return quickBrownAutomaton;
      else return null;
    }
  };
  RegexpQuery query = new RegexpQuery(newTerm("<quickBrown>"), RegExp.ALL,
      myProvider);
  assertEquals(1, searcher.search(query, 5).totalHits);
}
项目:search    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 * @param maxDeterminizedStates maximum number of states that compiling the
 *  automaton for the regexp can result in.  Set higher to allow more complex
 *  queries and lower to prevent memory exhaustion.
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider,
    int maxDeterminizedStates) {
  super(term,
        new RegExp(term.text(), flags).toAutomaton(
                     provider, maxDeterminizedStates), maxDeterminizedStates);
}
项目:read-open-source-code    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 * @param maxDeterminizedStates maximum number of states that compiling the
 *  automaton for the regexp can result in.  Set higher to allow more complex
 *  queries and lower to prevent memory exhaustion.
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider,
    int maxDeterminizedStates) {
  super(term,
        new RegExp(term.text(), flags).toAutomaton(
                     provider, maxDeterminizedStates), maxDeterminizedStates);
}
项目:lams    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider) {
  super(term, new RegExp(term.text(), flags).toAutomaton(provider));
}
项目:NYBC    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider) {
  super(term, new RegExp(term.text(), flags).toAutomaton(provider));
}
项目:read-open-source-code    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider) {
  super(term, new RegExp(term.text(), flags).toAutomaton(provider));
}
项目:read-open-source-code    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider) {
  super(term, new RegExp(term.text(), flags).toAutomaton(provider));
}
项目:Maskana-Gestor-de-Conocimiento    文件:RegexpQuery.java   
/**
 * Constructs a query for terms matching <code>term</code>.
 * 
 * @param term regular expression.
 * @param flags optional RegExp features from {@link RegExp}
 * @param provider custom AutomatonProvider for named automata
 */
public RegexpQuery(Term term, int flags, AutomatonProvider provider) {
  super(term, new RegExp(term.text(), flags).toAutomaton(provider));
}