internal void Add(Scorer scorer, bool required, bool prohibited) { int mask = 0; if (required || prohibited) { if (nextMask == 0) { throw new System.IndexOutOfRangeException("More than 32 required/prohibited clauses in query."); } mask = nextMask; nextMask = nextMask << 1; } else { mask = 0; } if (!prohibited) { maxCoord++; } if (prohibited) { prohibitedMask |= mask; } // update prohibited mask else if (required) { requiredMask |= mask; // update required mask } scorers = new SubScorer(scorer, required, prohibited, bucketTable.NewCollector(mask), scorers); }
public /*internal*/ BooleanScorer(Similarity similarity, int minNrShouldMatch, System.Collections.IList optionalScorers, System.Collections.IList prohibitedScorers) : base(similarity) { InitBlock(); this.minNrShouldMatch = minNrShouldMatch; if (optionalScorers != null && optionalScorers.Count > 0) { for (System.Collections.IEnumerator si = optionalScorers.GetEnumerator(); si.MoveNext();) { Scorer scorer = (Scorer)si.Current; maxCoord++; if (scorer.NextDoc() != NO_MORE_DOCS) { scorers = new SubScorer(scorer, false, false, bucketTable.NewCollector(0), scorers); } } } if (prohibitedScorers != null && prohibitedScorers.Count > 0) { for (System.Collections.IEnumerator si = prohibitedScorers.GetEnumerator(); si.MoveNext();) { Scorer scorer = (Scorer)si.Current; int mask = nextMask; nextMask = nextMask << 1; prohibitedMask |= mask; // update prohibited mask if (scorer.NextDoc() != NO_MORE_DOCS) { scorers = new SubScorer(scorer, false, true, bucketTable.NewCollector(mask), scorers); } } } coordFactors = new float[maxCoord]; Similarity sim = GetSimilarity(); for (int i = 0; i < maxCoord; i++) { coordFactors[i] = sim.Coord(i, maxCoord - 1); } }
public /*internal*/ BooleanScorer(Similarity similarity, int minNrShouldMatch, System.Collections.Generic.List <Scorer> optionalScorers, System.Collections.Generic.List <Scorer> prohibitedScorers) : base(similarity) { InitBlock(); this.minNrShouldMatch = minNrShouldMatch; if (optionalScorers != null && optionalScorers.Count > 0) { foreach (Scorer scorer in optionalScorers) { maxCoord++; if (scorer.NextDoc() != NO_MORE_DOCS) { scorers = new SubScorer(scorer, false, false, bucketTable.NewCollector(0), scorers); } } } if (prohibitedScorers != null && prohibitedScorers.Count > 0) { foreach (Scorer scorer in prohibitedScorers) { int mask = nextMask; nextMask = nextMask << 1; prohibitedMask |= mask; // update prohibited mask if (scorer.NextDoc() != NO_MORE_DOCS) { scorers = new SubScorer(scorer, false, true, bucketTable.NewCollector(mask), scorers); } } } coordFactors = new float[maxCoord]; Similarity sim = Similarity; for (int i = 0; i < maxCoord; i++) { coordFactors[i] = sim.Coord(i, maxCoord - 1); } }
public BooleanScorer(BooleanWeight weight, bool disableCoord, int minNrShouldMatch, IList <BulkScorer> optionalScorers, IList <BulkScorer> prohibitedScorers, int maxCoord) { this.MinNrShouldMatch = minNrShouldMatch; this.Weight = weight; foreach (BulkScorer scorer in optionalScorers) { Scorers = new SubScorer(scorer, false, false, bucketTable.NewCollector(0), Scorers); } foreach (BulkScorer scorer in prohibitedScorers) { Scorers = new SubScorer(scorer, false, true, bucketTable.NewCollector(PROHIBITED_MASK), Scorers); } CoordFactors = new float[optionalScorers.Count + 1]; for (int i = 0; i < CoordFactors.Length; i++) { CoordFactors[i] = disableCoord ? 1.0f : weight.Coord(i, maxCoord); } }
//private readonly Weight weight; // LUCENENET: Never read internal BooleanScorer(BooleanWeight weight, bool disableCoord, int minNrShouldMatch, IList <BulkScorer> optionalScorers, IList <BulkScorer> prohibitedScorers, int maxCoord) { this.minNrShouldMatch = minNrShouldMatch; //this.weight = weight; // LUCENENET: Never read foreach (BulkScorer scorer in optionalScorers) { scorers = new SubScorer(scorer, false, false, bucketTable.NewCollector(0), scorers); } foreach (BulkScorer scorer in prohibitedScorers) { scorers = new SubScorer(scorer, false, true, bucketTable.NewCollector(PROHIBITED_MASK), scorers); } coordFactors = new float[optionalScorers.Count + 1]; for (int i = 0; i < coordFactors.Length; i++) { coordFactors[i] = disableCoord ? 1.0f : weight.Coord(i, maxCoord); } }