Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5225,9 +5225,9 @@ dependencies = [

[[package]]
name = "stringdex"
version = "0.0.1-alpha4"
version = "0.0.1-alpha8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2841fd43df5b1ff1b042e167068a1fe9b163dc93041eae56ab2296859013a9a0"
checksum = "180d5e520e6b3f10adc18ed61aa464c2c54ad0d5403e7292d37558bc508eae83"
dependencies = [
"stacker",
]
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rustdoc-json-types = { path = "../rustdoc-json-types" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
smallvec = "1.8.1"
stringdex = { version = "0.0.1-alpha4" }
stringdex = { version = "0.0.1-alpha8" }
tempfile = "3"
threadpool = "1.8.1"
tracing = "0.1"
Expand Down
9 changes: 4 additions & 5 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ class DocSearch {
* will never fulfill.
*/
async buildIndex() {
const nn = this.database.getIndex("normalizedName");
const nn = this.database.getData("normalizedName");
if (!nn) {
return;
}
Expand Down Expand Up @@ -3706,7 +3706,7 @@ class DocSearch {
* @returns {AsyncGenerator<rustdoc.ResultObject>}
*/
async function*(currentCrate) {
const index = this.database.getIndex("normalizedName");
const index = this.database.getData("normalizedName");
if (!index) {
return;
}
Expand Down Expand Up @@ -3835,8 +3835,7 @@ class DocSearch {
};
if (elem.normalizedPathLast === "") {
// faster full-table scan for this specific case.
const nameData = this.database.getData("name");
const l = nameData ? nameData.length : 0;
const l = index.length;
for (let id = 0; id < l; ++id) {
if (!idDuplicates.has(id)) {
idDuplicates.add(id);
Expand Down Expand Up @@ -3938,7 +3937,7 @@ class DocSearch {
* @returns {AsyncGenerator<rustdoc.ResultObject>}
*/
async function*(inputs, output, typeInfo, currentCrate) {
const index = this.database.getIndex("normalizedName");
const index = this.database.getData("normalizedName");
if (!index) {
return;
}
Expand Down
13 changes: 2 additions & 11 deletions src/librustdoc/html/static/js/stringdex.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,8 @@ declare namespace stringdex {
* The client interface to Stringdex.
*/
interface Database {
getIndex(colname: string): SearchTree|undefined;
getData(colname: string): DataColumn|undefined;
}
/**
* A search index file.
*/
interface SearchTree {
trie(): Trie;
search(name: Uint8Array|string): Promise<Trie?>;
searchLev(name: Uint8Array|string): AsyncGenerator<Trie>;
}
/**
* A compressed node in the search tree.
*
Expand All @@ -29,9 +20,7 @@ declare namespace stringdex {
matches(): RoaringBitmap;
substringMatches(): AsyncGenerator<RoaringBitmap>;
prefixMatches(): AsyncGenerator<RoaringBitmap>;
keys(): Uint8Array;
keysExcludeSuffixOnly(): Uint8Array;
children(): [number, Promise<Trie>][];
childrenExcludeSuffixOnly(): [number, Promise<Trie>][];
child(id: number): Promise<Trie>?;
}
Expand All @@ -41,6 +30,8 @@ declare namespace stringdex {
interface DataColumn {
isEmpty(id: number): boolean;
at(id: number): Promise<Uint8Array|undefined>;
search(name: Uint8Array|string): Promise<Trie?>;
searchLev(name: Uint8Array|string): AsyncGenerator<Trie>;
length: number,
}
/**
Expand Down
Loading
Loading