public void Add(Query query) { if (query is TermQuery) { AddTerm(((TermQuery)query).Term.Text, query.Boost); } else if (query is PrefixQuery) { AddTerm(((PrefixQuery)query).Prefix.Text + "*", query.Boost); } else if (query is PhraseQuery) { PhraseQuery pq = (PhraseQuery)query; Term[] terms = pq.GetTerms(); HashMap <String, QueryPhraseMap> map = subMap; QueryPhraseMap qpm = null; foreach (Term term in terms) { qpm = GetOrNewMap(map, term.Text); map = qpm.subMap; } qpm.MarkTerminal(pq.Slop, pq.Boost); } else { throw new ApplicationException("query \"" + query.ToString() + "\" must be flatten first."); } }
internal void Add(Query query /*, IndexReader reader // LUCENENET: Never read */) { if (query is TermQuery termQuery) { AddTerm(termQuery.Term, query.Boost); } else if (query is PhraseQuery pq) { Term[] terms = pq.GetTerms(); IDictionary <string, QueryPhraseMap> map = subMap; QueryPhraseMap qpm = null; foreach (Term term in terms) { qpm = GetOrNewMap(map, term.Text); map = qpm.subMap; } qpm.MarkTerminal(pq.Slop, pq.Boost); } else { throw RuntimeException.Create("query \"" + query.ToString() + "\" must be flatten first."); } }
internal void Add(Query query, IndexReader reader) { if (query is TermQuery) { AddTerm(((TermQuery)query).Term, query.Boost); } else if (query is PhraseQuery) { PhraseQuery pq = (PhraseQuery)query; Term[] terms = pq.GetTerms(); IDictionary <string, QueryPhraseMap> map = subMap; QueryPhraseMap qpm = null; foreach (Term term in terms) { qpm = GetOrNewMap(map, term.Text()); map = qpm.subMap; } qpm.MarkTerminal(pq.Slop, pq.Boost); } else { throw new Exception("query \"" + query.ToString() + "\" must be flatten first."); } }
internal void AddTerm(Term term, float boost) { QueryPhraseMap map = GetOrNewMap(subMap, term.Text); map.MarkTerminal(boost); }
public void AddTerm(String termText, float boost) { QueryPhraseMap map = GetOrNewMap(subMap, termText); map.MarkTerminal(boost); }