コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
ファイル: LuceneSearch.cs プロジェクト: cairabbit/daf
 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));
 }
コード例 #6
0
ファイル: LuceneSearch.cs プロジェクト: cairabbit/daf
 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));
 }
コード例 #7
0
ファイル: LuceneSearch.cs プロジェクト: cairabbit/daf
 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));
 }
コード例 #8
0
ファイル: LuceneSearch.cs プロジェクト: cairabbit/daf
 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));
 }
コード例 #9
0
ファイル: LuceneSearch.cs プロジェクト: cairabbit/daf
 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));
 }
コード例 #10
0
        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));
        }