Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-search-indexer

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-search-indexer

Search index generator for Hexo static site generator

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

hexo-search-indexer Publish on NPM

hexo-search-indexer is a plugin for Hexo static site generator that generates JSON file that contains all data to implement site search. It's convenient to use with serverless app that searches on your website.

  • Generates search-ready JSON file with all data of the website.
  • Supports a few different languages, including English, French, Russian, Italian, Japanese, and many others.
  • Allows to define "reserved" words that won't be split during word normalize (e.g. ASP.NET will not be split into ASP and NET).
  • Optionally can include non-stemmed post content in the search index.

How it works

  1. The plugin scans all posts on the website and extracts words for every post.
  2. For every word stemmers are applied.
  3. All posts scanned to find which words they contain.
  4. The words dictionary saves into JSON file.
  5. Next you can upload this file into you app that handles search requests. For example, it's very convenient to use serverless application to do the search. 👌

Requirements

  • Hexo: 4.x
  • Node 12+

Usage

  1. Install the plugin using npm:
$ npm install hexo-search-indexer --save-dev
  1. Add search_indexer to Hexo config file (see details below).
  2. Run npx hexo generate-search-index
  3. search.json file will appear in the output folder.

Configuration

To configure the plugin add search_indexer to Hexo config file. Example:


search_indexer:
    enabled: true
    content: true
    include:
        - name: title
          cleanup: true
          index: true
    stemmers:
        - en
        - ru
    reserved:
        - asp.net
        - vs.net
        - ado.net
        - .net
    minWordLength: 5
    searchIndexFile: search.json
KeyRequiredDefault valueDescription
enablednotrueFlag to disable plugin execution.
contentnotrueWhether clean content should be included into index file as well. If false only words dictionary will be included in the index.
includeno[title]Array of properties that should be included into index file.
include[].nameyesProperty name that should be included into index file. This is the name of post object property.
include[].cleanupyesWhether property value should be cleaned up during indexing.
include[].indexyesWhether property value should be indexed (included into words section).
stemmersno[en, ru]The plugin "normailze" the text by clearing symbols from initial text. One of the technique is stemming. This param defines which languages should be used to stem the words. Possible values: nl, en, fr, id, it, jp, no/nb/nn, pt, ru, sv. Check Natural library for more details.
reservedno[]The array of the reserved words that won't be processed during words normalization. For example, ASP.NET will be splitted into ASP and NET by default. If you want to preserve this, you need to add this to reserved config.
minWordLengthno5Minimum word length. The words shorter than this param will be ignored.
searchIndexFilenosearch.jsonOutput file name.

Keywords

FAQs

Package last updated on 17 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc