예제 #1
0
 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
 public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
 {
     Search.Query snq = GetSpanNearQuery(sncf.IndexReader,
                                         sncf.FieldName,
                                         Weight,
                                         sncf.BasicQueryFactory);
     sncf.AddSpanQuery(snq);
 }
예제 #4
0
        public virtual void AddSpanQueries(SpanNearClauseFactory sncf)
        {
            var sqi = GetSubQueriesEnumerator();

            while (sqi.MoveNext())
            {
                ((IDistanceSubQuery)sqi.Current).AddSpanQueries(sncf);
            }
        }
예제 #5
0
 public AddSpanQueriesMatchingTermVisitor(SpanNearClauseFactory sncf, float weight)
 {
     this.sncf   = sncf;
     this.weight = weight;
 }