示例#1
0
 public BoostedWeight(BoostedQuery outerInstance, IndexSearcher searcher)
 {
     this.outerInstance = outerInstance;
     this.searcher      = searcher;
     this.qWeight       = outerInstance.q.CreateWeight(searcher);
     this.fcontext      = ValueSource.NewContext(searcher);
     outerInstance.boostVal.CreateWeight(fcontext, searcher);
 }
示例#2
0
 public CustomScorer(BoostedQuery outerInstance, AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs)
     : base(w)
 {
     this.outerInstance = outerInstance;
     this.weight        = w;
     this.qWeight       = qWeight;
     this.scorer        = scorer;
     this.readerContext = readerContext;
     this.vals          = vs.GetValues(weight.fcontext, readerContext);
 }
        public virtual void TestBasic()
        {
            Query q = new MatchAllDocsQuery();
            TopDocs docs = @is.Search(q, 10);
            assertEquals(1, docs.TotalHits);
            float score = docs.ScoreDocs[0].Score;

            Query boostedQ = new BoostedQuery(q, new ConstValueSource(2.0f));
            AssertHits(boostedQ, new float[] { score * 2 });
        }
示例#4
0
        public override Query Rewrite(IndexReader reader)
        {
            Query newQ = q.Rewrite(reader);

            if (newQ == q)
            {
                return(this);
            }
            BoostedQuery bq = (BoostedQuery)this.MemberwiseClone();

            bq.q = newQ;
            return(bq);
        }
示例#5
0
 public CustomScorer(BoostedQuery outerInstance, AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs)
     : base(w)
 {
     this.outerInstance = outerInstance;
     this.weight = w;
     this.qWeight = qWeight;
     this.scorer = scorer;
     this.readerContext = readerContext;
     this.vals = vs.GetValues(weight.fcontext, readerContext);
 }
示例#6
0
 public BoostedWeight(BoostedQuery outerInstance, IndexSearcher searcher)
 {
     this.outerInstance = outerInstance;
     this.searcher = searcher;
     this.qWeight = outerInstance.q.CreateWeight(searcher);
     this.fcontext = ValueSource.NewContext(searcher);
     outerInstance.boostVal.CreateWeight(fcontext, searcher);
 }