コード例 #1
0
ファイル: SimpleTerm.cs プロジェクト: sebastienros/lucenenet
 public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
 {
     VisitMatchingTerms(
         sncf.IndexReader,
         sncf.FieldName,
         new AddSpanQueriesMatchingTermVisitor(sncf, Weight));
 }
コード例 #2
0
        public virtual Search.Query GetSpanNearQuery(
            IndexReader reader,
            string fieldName,
            float boost,
            BasicQueryFactory qf)
        {
            SpanQuery[] spanClauses = new SpanQuery[NrSubQueries];
            var         sqi         = GetSubQueriesEnumerator();
            int         qi          = 0;

            while (sqi.MoveNext())
            {
                SpanNearClauseFactory sncf = new SpanNearClauseFactory(reader, fieldName, qf);

                ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
                if (sncf.Count == 0)
                {     /* distance operator requires all sub queries */
                    while (sqi.MoveNext())
                    { /* produce evt. error messages but ignore results */
                        ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
                        sncf.Clear();
                    }
                    return(SrndQuery.TheEmptyLcnQuery);
                }

                spanClauses[qi] = sncf.MakeSpanClause();
                qi++;
            }
            SpanNearQuery r = new SpanNearQuery(spanClauses, OpDistance - 1, QueriesOrdered);

            r.Boost = boost;
            return(r);
        }
コード例 #3
0
ファイル: OrQuery.cs プロジェクト: ChristopherHaws/lucenenet
 public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
 {
     var sqi = GetSubQueriesEnumerator();
     while (sqi.MoveNext())
     {
         ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
     }
 }
コード例 #4
0
 public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
 {
     Search.Query snq = GetSpanNearQuery(sncf.IndexReader,
                                         sncf.FieldName,
                                         Weight,
                                         sncf.BasicQueryFactory);
     sncf.AddSpanQuery(snq);
 }
コード例 #5
0
 public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
 {
     Search.Query snq = GetSpanNearQuery(sncf.IndexReader,
                           sncf.FieldName,
                           Weight,
                           sncf.BasicQueryFactory);
     sncf.AddSpanQuery(snq);
 }
コード例 #6
0
ファイル: OrQuery.cs プロジェクト: ywscr/lucenenet
        public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
        {
            var sqi = GetSubQueriesEnumerator();

            while (sqi.MoveNext())
            {
                ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
            }
        }
コード例 #7
0
ファイル: SimpleTerm.cs プロジェクト: sebastienros/lucenenet
 public AddSpanQueriesMatchingTermVisitor(SpanNearClauseFactory sncf, float weight)
 {
     this.sncf   = sncf;
     this.weight = weight;
 }
コード例 #8
0
        public virtual Search.Query GetSpanNearQuery(
            IndexReader reader,
            string fieldName,
            float boost,
            BasicQueryFactory qf)
        {
            SpanQuery[] spanClauses = new SpanQuery[NrSubQueries];
            var sqi = GetSubQueriesEnumerator();
            int qi = 0;
            while (sqi.MoveNext())
            {
                SpanNearClauseFactory sncf = new SpanNearClauseFactory(reader, fieldName, qf);

                ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
                if (sncf.Count == 0)
                { /* distance operator requires all sub queries */
                    while (sqi.MoveNext())
                    { /* produce evt. error messages but ignore results */
                        ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
                        sncf.Clear();
                    }
                    return SrndQuery.TheEmptyLcnQuery;
                }

                spanClauses[qi] = sncf.MakeSpanClause();
                qi++;
            }
            SpanNearQuery r = new SpanNearQuery(spanClauses, OpDistance - 1, QueriesOrdered);
            r.Boost = boost;
            return r;
        }