public override Query GetFieldQuery(System.String field, System.String queryText, int slop) { if (field == null) { System.Collections.ArrayList clauses = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); for (int i = 0; i < fields.Length; i++) { Query q = base.GetFieldQuery(fields[i], queryText); if (q != null) { //If the user passes a map of boosts if (boosts != null) { //Get the boost from the map and apply them System.Single boost = (System.Single)boosts[fields[i]]; //if (boost != null) // {{Aroush-2.1 there is no null for 'boost' if (boosts[fields[i]] != null) // {{Aroush-2.1 will this line do? { q.SetBoost((float)boost); } } if (q is PhraseQuery) { ((PhraseQuery)q).SetSlop(slop); } if (q is MultiPhraseQuery) { ((MultiPhraseQuery)q).SetSlop(slop); } clauses.Add(new BooleanClause(q, BooleanClause.Occur.SHOULD)); } } if (clauses.Count == 0) { // happens for stopwords return(null); } return(GetBooleanQuery(clauses, true)); } return(base.GetFieldQuery(field, queryText)); }
protected internal override Query GetFieldQuery(System.String field, System.String queryText, int slop) { if (field == null) { IList <BooleanClause> clauses = new List <BooleanClause>(); for (int i = 0; i < fields.Length; i++) { Query q = base.GetFieldQuery(fields[i], queryText); if (q != null) { //If the user passes a map of boosts if (boosts != null) { //Get the boost from the map and apply them if (boosts.Contains(fields[i])) { System.Single boost = (System.Single)boosts[fields[i]]; q.SetBoost((float)boost); } } ApplySlop(q, slop); clauses.Add(new BooleanClause(q, BooleanClause.Occur.SHOULD)); } } if (clauses.Count == 0) { // happens for stopwords return(null); } return(GetBooleanQuery(clauses, true)); } Query q2 = base.GetFieldQuery(field, queryText); ApplySlop(q2, slop); return(q2); }