public void Prefix(string fieldName, string prefix, ClauseOccur occur = ClauseOccur.SHOULD, float boost = 1.0f) { var q = new PrefixQuery(new Term(fieldName, prefix)); q.Boost = boost; query.Add(q, (Occur)((int)occur)); }
public void Wildcard(string fieldName, string word, ClauseOccur occur = ClauseOccur.SHOULD, float boost = 1.0f) { WildcardQuery wq = new WildcardQuery(new Term(fieldName, word)); wq.Boost = boost; query.Add(wq, (Occur)((int)occur)); }
public void Equals(string fieldName, string word, ClauseOccur occur = ClauseOccur.SHOULD, float boost = 1.0f) { TermQuery tq = new TermQuery(new Term(fieldName, word)); tq.Boost = boost; query.Add(tq, (Occur)((int)occur)); }
public void Where(string fieldName, string word, ClauseOccur occur = ClauseOccur.SHOULD, float boost = 1.0f) { QueryParser qp = new QueryParser(version, fieldName, analyzer); var q = qp.Parse(word); q.Boost = boost; query.Add(q, (Occur)((int)occur)); }
public void Range(string fieldName, object lowerValue, object upperValue, bool includeLower = true, bool includeUpper = true, ClauseOccur occur = ClauseOccur.SHOULD, float boost = 1.0f) { Query q = null; var f = DocumentBuilder.GetField(TypeName, fieldName); switch (f.FieldType) { case FieldType.Int: q = NumericRangeQuery.NewIntRange(fieldName, (int)lowerValue, (int)upperValue, includeLower, includeUpper); break; case FieldType.Long: q = NumericRangeQuery.NewLongRange(fieldName, (long)lowerValue, (long)upperValue, includeLower, includeUpper); break; case FieldType.Float: q = NumericRangeQuery.NewFloatRange(fieldName, (float)lowerValue, (float)upperValue, includeLower, includeUpper); break; case FieldType.Double: q = NumericRangeQuery.NewDoubleRange(fieldName, (double)lowerValue, (double)upperValue, includeLower, includeUpper); break; case FieldType.DateTime: q = new TermRangeQuery(fieldName, DateTools.DateToString((DateTime)lowerValue, DateTools.Resolution.MILLISECOND), DateTools.DateToString((DateTime)upperValue, DateTools.Resolution.MILLISECOND), includeLower, includeUpper); break; case FieldType.String: default: q = new TermRangeQuery(fieldName, lowerValue.ToString(), upperValue.ToString(), includeLower, includeUpper); break; } q.Boost = boost; query.Add(q, (Occur)((int)occur)); }