Java Code Examples for org.apache.lucene.util.automaton.Automata#makeStringUnion()
The following examples show how to use
org.apache.lucene.util.automaton.Automata#makeStringUnion() .
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: IncludeExclude.java From Elasticsearch with Apache License 2.0 | 6 votes |
private Automaton toAutomaton() { Automaton a = null; if (include != null) { a = include.toAutomaton(); } else if (includeValues != null) { a = Automata.makeStringUnion(includeValues); } else { a = Automata.makeAnyString(); } if (exclude != null) { a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES); } else if (excludeValues != null) { a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES); } return a; }
Example 2
Source File: TestAutomatonQuery.java From lucene-solr with Apache License 2.0 | 5 votes |
public void testBiggishAutomaton() { int numTerms = TEST_NIGHTLY ? 3000 : 500; List<BytesRef> terms = new ArrayList<>(); while (terms.size() < numTerms) { terms.add(new BytesRef(TestUtil.randomUnicodeString(random()))); } Collections.sort(terms); new AutomatonQuery(new Term("foo", "bar"), Automata.makeStringUnion(terms), Integer.MAX_VALUE); }
Example 3
Source File: XJoinQParserPlugin.java From BioSolr with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") Filter makeFilter(String fname, Iterator<BytesRef> it) { Automaton union = Automata.makeStringUnion(IteratorUtils.toList(it)); return new MultiTermQueryWrapperFilter<AutomatonQuery>(new AutomatonQuery(new Term(fname), union)) { }; }
Example 4
Source File: CharArrayMatcher.java From lucene-solr with Apache License 2.0 | 4 votes |
static CharArrayMatcher fromTerms(List<BytesRef> terms) { CharacterRunAutomaton a = new CharacterRunAutomaton(Automata.makeStringUnion(terms)); return a::run; }
Example 5
Source File: TermsQParserPlugin.java From lucene-solr with Apache License 2.0 | 4 votes |
@Override Query makeFilter(String fname, BytesRef[] byteRefs) { ArrayUtil.timSort(byteRefs); // same sort algo as TermInSetQuery's choice Automaton union = Automata.makeStringUnion(Arrays.asList(byteRefs)); // input must be sorted return new AutomatonQuery(new Term(fname), union);//constant scores }
Example 6
Source File: XJoinQParserPlugin.java From BioSolr with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") Query makeQuery(String fname, Iterator<BytesRef> it) { Automaton union = Automata.makeStringUnion(IteratorUtils.toList(it)); return new AutomatonQuery(new Term(fname), union); }
Example 7
Source File: XJoinQParserPlugin.java From BioSolr with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") Query makeQuery(String fname, Iterator<BytesRef> it) { Automaton union = Automata.makeStringUnion(IteratorUtils.toList(it)); return new AutomatonQuery(new Term(fname), union); }