/// <summary> /// f(source) = a/(m*float(source)+b) /// </summary> /// <param name="source"></param> /// <param name="m"></param> /// <param name="a"></param> /// <param name="b"></param> public ReciprocalFloatFunction(ValueSource source, float m, float a, float b) { this.source = source; this.m = m; this.a = a; this.b = b; }
public ValueSourceFilter(Filter startingFilter, ValueSource source, double min, double max) { if (startingFilter == null) { throw new ArgumentException("please provide a non-null startingFilter; you can use QueryWrapperFilter(MatchAllDocsQuery) as a no-op filter", "startingFilter"); } this.startingFilter = startingFilter; this.source = source; this.min = min; this.max = max; }
public MultiValueSource(ValueSource other) { this.other = other; }
public Query MakeQueryWithValueSource(SpatialArgs args, ValueSource valueSource) { var bq = new BooleanQuery(); var spatial = MakeFilter(args); bq.Add(new ConstantScoreQuery(spatial), Occur.MUST); // This part does the scoring Query spatialRankingQuery = new FunctionQuery(valueSource); bq.Add(spatialRankingQuery, Occur.MUST); return bq; }
/* scores[] are in docId order */ protected void checkValueSource(ValueSource vs, float[] scores, float delta) { FunctionQuery q = new FunctionQuery(vs); // //TODO is there any point to this check? // int expectedDocs[] = new int[scores.length];//fill with ascending 0....length-1 // for (int i = 0; i < expectedDocs.length; i++) { // expectedDocs[i] = i; // } // CheckHits.checkHits(random(), q, "", indexSearcher, expectedDocs); TopDocs docs = indexSearcher.Search(q, 1000); //calculates the score for (int i = 0; i < docs.ScoreDocs.Length; i++) { ScoreDoc gotSD = docs.ScoreDocs[i]; float expectedScore = scores[gotSD.Doc]; assertEquals("Not equal for doc " + gotSD.Doc, expectedScore, gotSD.Score, delta); } CheckHits.checkExplanations(q, "", indexSearcher); }
/// <summary> Create a value source query</summary> /// <param name="valSrc">provides the values defines the function to be used for scoring /// </param> public ValueSourceQuery(ValueSource valSrc) { this.valSrc = valSrc; }
public FunctionQuery(ValueSource func) { this.func = func; }
public CachingDoubleValueSource(ValueSource source) { this.source = source; cache = new Dictionary<int, double>(); }