Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Full-search implementation concerns #661

@evil-shrike

Description

@evil-shrike

First of all full-search is awesome. Really cool. But let me criticize a bit.

  1. Why do we need search-stopwords.json?
    lurn already contains built-in stopwords for English. But you remove default stopWordFilter, then load a separate stopwords index file and generate a filter based on it. Why?
    That search-stopwords.json contains the same stopwords as default builtin filter!
    Moreover lunr addons for languages (from https://github.com/MihaiValentin/lunr-languages) contains their own stop words.
  2. Why not build index in build-time? Why instead do you load json in run-time and then add item by item into index. It can be done (and usually done) in build time. Then in run-time we can just load an index file:
    $.getJSON("index.json", function (data) { engine = lunr.Index.load(data); })
    That's all.
    I understand that you enrich search results with title and keywords which are absent in lunr.search's result. But it can be done via additional index file.
  3. no i18n
    Index should be built with honor of other languages. lunr natively supports only English. For additional languages support we need to add addons (from https://github.com/MihaiValentin/lunr-languages):
    in buildtime:
var lunr = require('lunr');
require('./lunr.stemmer.support.js')(lunr);
require('./lunr.ru.js')(lunr);
require('./lunr.multi.js')(lunr);
var lunrIdx = lunr(function() {
  this.use(lunr.multiLanguage('en', 'ru'));
  // config ref/fields
});

in runtime:

lunr.multiLanguage('en', 'ru');
engine = lunr.Index.load(data);

I can create a template for customization of index building but I think it should possible without template customization. Also please see #650 - these're problems with encoding of extracted keywords for indexing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    searchSearch content for a static site

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions