Results
Search returns a Result object containing ranked document keys and scores — not full JSON. Retrieve full documents with GetJsonDataOfKey.
Basic Usage
var result = engine.Search(query);
if (result != null)
{
foreach (var rec in result.Records)
{
long key = rec.DocumentKey;
int score = rec.Score;
string json = engine.GetJsonDataOfKey(key);
Console.WriteLine(quot;[{score}] {json}");
}
}Result Properties
| Property | Type | Description |
|---|---|---|
Records | ScoreEntry16[] | Ranked documents. Each has DocumentKey (long) and Score (ushort, 0–65535) |
Facets | Dictionary<string, KeyValuePair<string, int>[]>? | Field → value/count pairs, a value counted case-insensitively and shown as first written, over the records counted (all of them, not only the rows returned). null when EnableFacets is false |
ToleranceCounts | ToleranceCounts? | How many documents hold every query word Exactly, within OneEdit, within TwoEdits and within ThreeEdits (each rung with those below it; a rung not worked out is null), and with Candidates.Rest the Rest: the counted rung's documents and the related ones taken below them (not every document pattern recognition touched; null without Rest or when nothing was counted). null in Bm25f mode ThroughSynonym: of the counted, those holding a run of words only through a synonym (null when none fired). |
CountedTolerance | Tolerance? | The rung counted: the first with hits, or the farthest with Match.Rungs = All. null when nothing was counted |
Count | int | How many documents answer the search, in every mode: in EditDistance the rung counted (with Candidates.Rest, the rest taken too), in the fallback the documents holding the most of the words, in Bm25f every document with a score above 0 (with patterns nearly the whole corpus), in an empty search every document the filter lets through |
Ranked | int | How many were ranked, at most the candidate bound (the rows times CandidatesPerRow, at least 100, at most 5 000, or MaxCandidates). Count > Ranked: the bound was too small for them all, raise MaxCandidates or add words. Ranked > Records.Length: more were ranked than the rows asked for, so a next page has more |
IsFallback | bool | No document held every query word: the list is the documents holding the most of the words, then pattern matches |
MatchReport | MatchReport? | With Query.EnableMatchReport: Matches, one RecordMatch a record in the order of Records (its DocumentKey, and for each query word a QueryWordMatch: the word, the field that confirmed it, and how - a WordMatch), and MatchesByField, per field the count of each WordMatch. null when the report is not asked for A word the record holds only through a synonym is Synonym, with no field. |
Reranked | bool | Whether the reranker ordered the list ( Ranking.Rerank as the search ran it: the request's, else the dataset's or the default), in either mode. |
Fill | PageFill? | How many listed records fill a short page, not counted: NextRungs (every word, on a typo level past the one counted), MostWords (holding the most of the words, with Candidates.FillWithMostWords). In the list they follow the counted records in that order, then what Candidates.Rest takes. Both 0 when the counted records filled the rows; null in Bm25f mode. |
DidTimeOut | bool | true if scoring was cut short by TimeOutLimitMilliseconds |
Facet Counts and Filter Counts
A facet counts a value case-insensitively, as a value filter does, so a dataset that spells a value
both ways, Fiction and FICTION, lists it once, shown as first written, with the documents of both
spellings; clicking it with a value filter returns exactly that count. The facets are counted over
the records the search counted, every one of them, also when only some are returned or the count
overflowed, so they always add up with the count.
A document whose array holds the same value twice counts once, so an array field's facet counts agree with its own filter.
Working with Facets
query.EnableFacets = true;
var result = engine.Search(query);
if (result.Facets != null)
{
foreach (var facet in result.Facets)
{
Console.WriteLine(quot;{facet.Key}:");
foreach (var bucket in facet.Value)
Console.WriteLine(quot; {bucket.Key} ({bucket.Value})");
}
}Retrieving Full Documents
// Single document
string json = engine.GetJsonDataOfKey(result.Records[0].DocumentKey);
// Multiple documents
foreach (var record in result.Records)
Console.WriteLine(engine.GetJsonDataOfKey(record.DocumentKey));ScoreEntry16
| Property | Type | Description |
|---|---|---|
DocumentKey | long | Unique key identifying the document |
Score | ushort | Relevance score 0–65535. Higher is more relevant |
Constructors
Result()Initializes a default empty result.
ToleranceCounts(int Exact, int? OneEdit, int? TwoEdits, int? ThreeEdits = null, int? Rest = null, int? ThroughSynonym = null)intExactint?OneEditint?TwoEditsint?ThreeEdits— Default: nullint?Rest— Default: nullint?ThroughSynonym— Default: null
PageFill(int NextRungs, int MostWords)How many of the records listed fill a short page, not counted ():holding every word on a rung past the one counted,holding the most of the words (). The list's order is fixed by its bands, so a client reads each record's kind by its place: the counted first, then the next rungs' fill, then the most-words fill, then whattakes.
intNextRungsintMostWords
MatchReport()For the serializer.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
DidTimeOut | bool | get/set | True when the search could not be served, rather than served and found
nothing. Two situations set it: |
Reason | ProcessError | get/set | RecordsWhy this search returned nothing, when the cause was the request or this engine rather
than an absence of matches. Null on a normal search, including one that legitimately
matched nothing — an emptywith a null Reason means "no matches",
which is the distinction a caller could not previously make. |
SystemState | SystemState | get/set | SystemStatusThe engine's state at the moment this search ran, which is what a caller needs to decide
whether to retry:orwill pass, a bad request will not.
A snapshot of the one field worth copying — the rest ofis
engine-wide and describes the engine over time rather than this request, so reading it
per search would report other callers' conditions as if they were yours. |
Facets | Dictionary<string, KeyValuePair<string, int>[]> | get/set | Facet counts per facetable field, keyed by field name. Null when no facetable fields are configured. |
FacetStats | Dictionary<string, FacetStats> | get/set | FacetValueLimitFor each number field among the facets counted, the lowest and highest value in the set
the facets are counted over, and how many of its records hold one (null for an array
field, whose records can hold several). What a range slider reads. Of every value
counted, before; null without facets. |
Records | ScoreEntry16[] | get/set | Ranked search hits in descending score order. |
MatchReport | MatchReport | get/set | EnableMatchReportHow Coverage met each query word in each record, when the query asked for it
(), in any mode; null when not asked for. |
Reranked | bool | get/set | RerankWhether the reranker ordered the list (, as the
search ran it: the request's, else the dataset's or the engine's default), in either mode.
False for a search that returned nothing to order. |
Fill | PageFill | get/set | How many of the records listed fill a short page and from where, not counted
(): both 0 when the counted records filled the rows. Of the list
from the first ranked record: with, the record at index i ofis at place Offset + i of it.
Null without the word lookup (). |
ToleranceCounts | ToleranceCounts | get/set | Bm25fHow many documents hold every word of the query, rung by rung: exactly, within one edit,
within two, within three, each with the rungs below, as far as the search asks for and
the candidate bound let the word lookup go. It tells that every document holding a word
is found without scoring them all. Null without the word lookup
(), or when no query word is long enough to look up. |
CountedTolerance | Tolerance? | get/set | IsFallbackThe rung counted: the first that gave hits, every document on it in the list's set,
ranked and never cut but to the rows asked for. Null when no rung gave a hit
() or without the lookup. |
Count | int | get/set | How many documents answer the search, in every mode: inthe rung counted (), withthe rest taken too, in the fallback the documents holding
the most of the words; inthe documents with a score above
0 (with patterns nearly the whole corpus); in an empty search every document the filter
lets through.: the candidate bound was too small for them all.
0 when nothing was counted and the fallback is off (false): no records, nothing to count. |
Counts | Dictionary<string, int> | get/set | For each name in, how many of the documentscounts its filter lets through. Null when the query named none. |
Ranked | int | get/set | How many documents were ranked, at most the candidate bound
(, else the rows times, at most 5 000).: more were ranked than the rows asked for, an overflow at the rows. |
IsFallback | bool | get/set | FallbackTrue when no document holds every word within the tolerance, and the list is
the fallback: the documents holding the most of the words first, the
pattern matches after them. Off withfalse, which gives an empty list instead. |
Exact | int | get/set | Met exactly. |
OneEdit | int? | get/set | Exactly or within one edit; null when not asked for or not worked out. |
TwoEdits | int? | get/set | Within up to two edits; null when not asked for or not worked out. |
ThreeEdits | int? | get/set | Within three edits; null when not asked for or not
worked out, as the other rungs. |
Rest | int? | get/set | RestThe counted rung's documents and BM25F's best taken below them, with; null without it, or with nothing counted. |
ThroughSynonym | int? | get/set | Of the documents counted, those holding a slot of the synonym
list on their rung only through a synonym, not as typed; null when no synonym
fired. |
NextRungs | int | get/set | |
MostWords | int | get/set | |
Matches | RecordMatch[] | get/set | RecordsPer record, in the same order as. |
MatchesByField | IReadOnlyDictionary<string, IReadOnlyDictionary<WordMatch, int>> | get/set | Per field: how many query words were met each way, over the returned records.
A word no field confirmed is counted in no field. |
Methods
MakeEmptyResult
Returns an empty result, optionally marked as having timed out.
static Result MakeEmptyResult(bool timedOut = false, ProcessError reason = null, SystemState systemState = Created)booltimedOut— DidTimeOutSets— the search could not be served.ProcessErrorreason— ReasonSets; null for a transient failure or a genuine miss.SystemStatesystemState— SystemStateSets— the engine state when the search ran. Defaults torather than: a caller who omits it has not established that the engine was ready, and defaulting to the optimistic value would put an unverified claim in the result.
Returns: Result
ToString
string ToString()Returns: string
GetHashCode
int GetHashCode()Returns: int
Equals
bool Equals(object obj)objectobj
Returns: bool
<Clone>$
ToleranceCounts <Clone>$()Returns: ToleranceCounts
Deconstruct
void Deconstruct(Int32& Exact, Nullable`1& OneEdit, Nullable`1& TwoEdits, Nullable`1& ThreeEdits, Nullable`1& Rest, Nullable`1& ThroughSynonym)Int32&ExactNullable`1&OneEditNullable`1&TwoEditsNullable`1&ThreeEditsNullable`1&RestNullable`1&ThroughSynonym
ScoreEntry16struct
A result's document key and score, the score in the range 0..65535.
| Name | Type | Description |
|---|---|---|
DocumentKey | long | Id, key or internal index of a document. |
Score | UInt16 | The 16-bit score value of the document. |
WordMatchenum
MatchReportHow Coverage met a query word in a record ().
| Name | Value |
|---|---|
NotFound | 0 |
Whole | 1 |
Prefix | 2 |
Suffix | 3 |
Joined | 4 |
RunTogether | 5 |
OneEdit | 6 |
TwoEdits | 7 |
ThreeEdits | 8 |
Synonym | 9 |