npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-search-indexer

v3.0.0

Published

Search index generator for Hexo static site generator

Downloads

2

Readme

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

| Key | Required | Default value | Description | | --- | --- | --- | --- | | enabled | no | true | Flag to disable plugin execution. | | content | no | true | Whether clean content should be included into index file as well. If false only words dictionary will be included in the index. | | include | no | [title] | Array of properties that should be included into index file. | | include[].name | yes | | Property name that should be included into index file. This is the name of post object property. | | include[].cleanup | yes | | Whether property value should be cleaned up during indexing. | | include[].index | yes | | Whether property value should be indexed (included into words section). | | stemmers | no | [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. | | reserved | no | [] | 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. | | minWordLength | no | 5 | Minimum word length. The words shorter than this param will be ignored. | | searchIndexFile | no | search.json | Output file name. |