How to use this plugin in my Hexo blog? You have two choices:
you don't want to write search engine by yourself. There are many themes that take use this plugin for local searching that works out of box.
you are familiar with JavaScript and would like to write your own search engine. You can implement one by yourself according to the template code search.js. There is no documentation at present, but you can find its usage in the source code of the theme NexT. Generally there are 3 steps:
write a search view. This is the place for displaying a search form and search results; load the search.js script via CDN, for example: <script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.4.0/dist/search.js"></script> A LocalSearch class is provided in the search.js which tells the browser how to grab search data and filter out contents what we're searching;
write a search script, make use of the previous LocalSearch class.
# Local Search # Dependencies: https://github.com/next-theme/hexo-generator-searchdb local_search: enable:false # If auto, trigger search by changing input. # If manual, trigger search by pressing enter key or search button. trigger:auto # Show top n results per article, show all results by setting to -1 top_n_per_article:1 # Unescape html strings to the readable one. unescape:false # Preload the search data when the page loads. preload:false