IncrementalScorer class

Incremental scorer that caches previous query results.

When the new query is a prefix extension of the previous query, only re-scores items that previously matched (O(M×L) instead of O(N×L)). Falls back to full scan for non-extending queries.

final inc = IncrementalScorer();
var r1 = inc.scoreCorpus('gd', titles);
var r2 = inc.scoreCorpus('gdo', titles); // incremental — only rescores matches

Constructors

IncrementalScorer({BayesianScorer? scorer})

Properties

fullScans int
Number of full scans performed.
no setter
hashCode int
The hash code for this object.
no setterinherited
incrementalScans int
Number of incremental scans performed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalEvaluated int
Total items evaluated across all scans.
no setter

Methods

invalidate() → void
Invalidate the cache (forces full scan on next call).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scoreCorpus(String query, List<String> corpus, {int? generation}) List<MatchResult>
Score all items in corpus, returning match results.
scoreCorpusWithTags(String query, List<String> corpus, List<List<String>> tags, {int? generation}) List<MatchResult>
Score all items with tags, returning match results.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited