Java Code Examples for org.apache.lucene.util.automaton.RegExp#ALL
The following examples show how to use
org.apache.lucene.util.automaton.RegExp#ALL .
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: TestRegexpQuery.java From lucene-solr with Apache License 2.0 | 6 votes |
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.value); }
Example 2
Source File: QueryParserBase.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Builds a new RegexpQuery instance * @param regexp Regexp term * @return new RegexpQuery instance */ protected Query newRegexpQuery(Term regexp) { RegexpQuery query = new RegexpQuery(regexp, RegExp.ALL, maxDeterminizedStates); query.setRewriteMethod(multiTermRewriteMethod); return query; }
Example 3
Source File: LuceneQueryBuilder.java From Elasticsearch with Apache License 2.0 | 4 votes |
private Query toLuceneRegexpQuery(String fieldName, BytesRef value, Context context) { return new ConstantScoreQuery( new RegexpQuery(new Term(fieldName, value), RegExp.ALL)); }
Example 4
Source File: RegexpMatchQuery.java From crate with Apache License 2.0 | 4 votes |
private static Query toLuceneRegexpQuery(String fieldName, String value) { return new ConstantScoreQuery( new RegexpQuery(new Term(fieldName, value), RegExp.ALL)); }
Example 5
Source File: RegexCompletionQuery.java From lucene-solr with Apache License 2.0 | 2 votes |
/** * 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 6
Source File: RegexpQuery.java From lucene-solr with Apache License 2.0 | 2 votes |
/** * Constructs a query for terms matching <code>term</code>. * <p> * By default, all regular expression features are enabled. * </p> * * @param term regular expression. */ public RegexpQuery(Term term) { this(term, RegExp.ALL); }