forked from olivernn/lunr.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes
47 lines (34 loc) · 1.03 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
1 - "Mr. Green killed Colonel Mustard in the study with the candlestick. Mr. Green is not a very nice fellow."
2 - "Professor Plumb has a green plant in his study."
3 - "Miss Scarlett watered Professor Plumb's green plant while he was away from his office last week."
l1 = 19
l2 = 9
l3 = 16
q1 - "green"
q1 = [0.0, 0.71]
1 = [0.0, 0.0747]
2 = [0.0, 0.1555]
3 = [0.0, 0.0875]
green : total count = 4, idf = 0.71
mr : total count = 2, idf = 1.40
the : total count = 2, idf = 1.40
plant : total count = 2, idf = 1.40
q2 = "Mr. Green"
q2 = [1.4, 0.71]
1 = [0.147, 0.0747]
2 = [0, 0.1555]
3 = [0, 0.0875]
q3 = "the green plant"
q3 = [0.5, 0.25, 0.5]
1 = [1, 0.5, 0]
2 = [0, 0.25, 0.5]
3 = [0, 0.25, 0.5]
Inverse Index as a trie
values are {docId: score} where score is the sum of tf across fields, with multipliers applied
when querying calculate the idf and multiply it by the tf
for a multi term query generate a vector using the idf
find all the documents that match both queries, and generate a tf*idf
word: {
totalCount: 123,
docs:
}