Write similarity(search, doc): how well a document matches a search. Higher means more similar. Both are word counts over [cat, dog, fish], so catcatfish is [2, 0, 1].
Someone searches “cat cat fish”. Your function gives every document a score, and the highest score goes to the top of the results. Type a score for each document and watch the results re-rank.
similarity(search, doc)| search | what someone typed | e.g. [2, 0, 1] |
| doc | a document both count words: [cat, dog, fish] "cat cat fish" -> np.array([2., 0., 1.]) | e.g. [1, 0, 1] |
| returns | one number. Higher means more similar. | |