zettel
zettel copied to clipboard
Implented Search for Notes
I have been working on the Search implementation. I had to generate an Index File with the title and tags as JSON and use that with some Client Side JS to make it working. I have deployed the docs of zettel wrt this PR. You can find it here :point_right: https://zettel-search.surge.sh/
Do provide feedback on where it could be changed or not
The prototype looks nice.

Any idea why the null is appearing?
BTW, did you checkout LunrJS which generates an index file automatically?
Lunr.js still says to build an Index for static sites
For large numbers of documents, it can take time for Lunr to build an index. The time taken to build the index can lead a browser to block; making your site seem unresponsive. A better way is to pre-build the index, and serve a serialised index that Lunr can load on the client side much quicker. This technique is useful with large indexes, or with documents that are largely static, such as with a static website.
Rather than using Lunr to build the index, it's easier to create an Index at Build time and is the easier option, so I went for it
Any idea why the null is appearing?
This is because no tags are given with the post. I will add a conditional clause to check if any tags are present or not
Hey @mr-karan updated the code. The update code's demo can be found in https://zettel-search.surge.sh/ (the same url)
@athul Thanks. Went through the changes and the code. I don't think this is a FTS and there are some errors in the search result:

Moreover, we can't search based on any word, it seems to only work for the headings. Is that how it's intended?
The Body is not indexed(higher than 20kb search.json file) , thus yes, It isn't a FTS. Fuze.js is a fuzzy search package, if it finds anything similar to the keyword, it will respond with a result.
it seems to only work for the headings
The Indexed things are titles and tags and these are used as the search keys
May be we can give an option to the user to include the content as well?