protected internal override Weight CreateWeight(Searcher searcher) { if (termArrays.Count == 1) { // optimize one-term case Term[] terms = (Term[])termArrays[0]; BooleanQuery boq = new BooleanQuery(true); for (int i = 0; i < terms.Length; i++) { boq.Add(new TermQuery(terms[i]), BooleanClause.Occur.SHOULD); } boq.SetBoost(GetBoost()); return(boq.CreateWeight(searcher)); } return(new PhrasePrefixWeight(this, searcher)); }
protected internal override Weight CreateWeight(Searcher searcher) { if (termArrays.Count == 1) { // optimize one-term case Term[] terms = (Term[]) termArrays[0]; BooleanQuery boq = new BooleanQuery(true); for (int i = 0; i < terms.Length; i++) { boq.Add(new TermQuery(terms[i]), BooleanClause.Occur.SHOULD); } boq.SetBoost(GetBoost()); return boq.CreateWeight(searcher); } return new PhrasePrefixWeight(this, searcher); }