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 dist/Index/InvertedIndex.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export declare class InvertedIndex {
private index;
constructor(dictionaryOrFileName?: any, terms?: Array<TermOccurrence>, comparator?: WordComparator);
readPostingList(fileName: string): void;
keyComparator: (a: (string | number)[], b: (string | number)[]) => 1 | -1 | 0;
keyComparator: (a: (string | number)[], b: (string | number)[]) => 0 | 1 | -1;
saveSorted(fileName: string): void;
save(fileName: string): void;
add(termId: number, docId: number): void;
postingListComparator: (listA: PostingList, listB: PostingList) => 1 | -1 | 0;
postingListComparator: (listA: PostingList, listB: PostingList) => 0 | 1 | -1;
autoCompleteWord(wordList: Array<string>, dictionary: TermDictionary): void;
search(query: Query, dictionary: TermDictionary): QueryResult;
}
2 changes: 1 addition & 1 deletion dist/Index/PositionalIndex.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export declare class PositionalIndex {
private positionalIndex;
constructor(dictionaryOrFileName?: any, terms?: Array<TermOccurrence>, comparator?: WordComparator);
readPositionalPostingList(fileName: string): void;
keyComparator: (a: (string | number)[], b: (string | number)[]) => 1 | -1 | 0;
keyComparator: (a: (string | number)[], b: (string | number)[]) => 0 | 1 | -1;
saveSorted(fileName: string): void;
save(fileName: string): void;
addPosition(termId: number, docId: number, position: number): void;
Expand Down
2 changes: 1 addition & 1 deletion dist/Index/PositionalIndex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Index/PositionalIndex.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/Query/QueryResult.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Query/QueryResult.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/Index/PositionalIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class PositionalIndex {
}
}
for (let docID of scores.keys()){
result.add(docID, scores.get(docID) / documents[docID].getSize())
result.add(docID, Math.sqrt(scores.get(docID)) / (documents[docID].getSize()*query.size()))
}
result.getBest(documentsReturned)
return result
Expand Down
4 changes: 2 additions & 2 deletions source/Query/QueryResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class QueryResult {
for (let searchedItem of this.items){
let low = 0
let high = queryResult.size() - 1
let middle = (low + high) / 2
let middle = Math.floor((low + high) / 2)
let found = false
while (low <= high){
if (searchedItem.getDocId() > queryResult.items[middle].getDocId()){
Expand All @@ -59,7 +59,7 @@ export class QueryResult {
break
}
}
middle = (low + high) / 2
middle = Math.floor((low + high) / 2)
}
if (found){
result.add(searchedItem.getDocId(), searchedItem.getScore())
Expand Down