Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
        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 });
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }