3 ms·
I'm wrote my own site generator a while back and have always been considering adding in a simple js search, but the client would download the index, which is ge
by jimktrains2 9y ago
I'm wrote my own site generator a while back and have always been considering adding in a simple js search, but the client would download the index, which is generated at compile time.
Even for a small blog the index might become decent size, though. I thought maybe a heavily pruned TF-IDF index could be workable though?
- marcuslager 9y ago>the client would download the index That doesn't sound like too bad of an idea, given the state of js these days. Yes, you can cut off irrelevant terms, those with low tf-idf score (the, a, is, are...) or you could filter out stopwords. Or both. Me personally, I would never remove low-scoring terms. Consider the state of the word "is". It's mostly irrelevant, unless you are searching for information about a certain terrorist group. One small index type (as in number of bytes) is a trie. Another is a huffman tree. They store each term less than once.
- jimktrains2 9y agoThe disadvantage(?) of a trie is that you can't rank by relevance.
- marcuslager 9y agoThere is no such disadvantage. Scoring usually comes after the index (tree) lookup. Once you have terms you can weight them. The trie is just a lookup mechanism.