method of static class JsNgram
Description
Rebuild an array of raw results of json indexes loaded.
Sort by document and N-gram key preparing for matching.
Count the number of hits and put it in the property work
as an array of [hits, documents]
.
Example
JsNgram.sortResultsByLocation(results);
Usage
sortResultsByLocation(results);
Argument results is an array of json indexes.
The sequence must be by the N-gram key number.
The output format is for the method findPerfection
and sortFoundByDocumentPosition
.
The output format is:
{ document id: { N-gram key number: [position, position, position, ... ], N-gram key number: [position, position, position, ... ], N-gram key number: [position, position, position, ... ] }, document id: { N-gram key number: [position, position, position, ... ], N-gram key number: [position, position, position, ... ] } }
In above notation, N-gram key number is a sequence number of each N-gram key. For example, for searching "alice", following four N-gram keys are generated: "al", "li", "ic" and "ce" with the N-gram key number is 0, 1, 2 and 3, respectively.