Giter VIP home page Giter VIP logo

Comments (5)

brockfanning avatar brockfanning commented on May 12, 2024

As I understood it, this:

var idx = new lunr.Index;

doesn't add the stopWordFilter or stemmer. You have to actually add those:

idx.pipeline.add(lunr.stopWordFilter, lunr.stemmer);

from lunr.js.

olivernn avatar olivernn commented on May 12, 2024

As @brockfanning says it is possible to create an index with a completely empty pipeline, using lunr() is just a convenience that provides the defaults that will work for most people, if you need to start customising things you can just create an index with its constructor new lunr.Index.

What config values do you want to pass in when creating the index though?

from lunr.js.

hadees avatar hadees commented on May 12, 2024

I guess new lunr.Index does do what I wanted but it still seems a little strange to me.

I was thinking something along the lines of being able to pass in an array that gets set the the pipeline. It would allow me to pass in an empty array and also would be it easier for people adding other pipelines instead of having to call pipeline.add for each one.

from lunr.js.

olivernn avatar olivernn commented on May 12, 2024

I'm working on a feature to add better support for languages other than english, as part of that the whole pipeline does need to reset so this should be easier in the next version, see #16 (comment) for some more detail.

Currently lunr.Pipeline.prototype.add does allow adding more than one function to the pipeline at a time, so you could do something like this:

var idx = new lunr.Index
idx.pipeline.add(fn1, fn2, fn3)

from lunr.js.

olivernn avatar olivernn commented on May 12, 2024

The latest release adds a new method to reset the existing pipeline lunr.Pipeline.prototype.reset so you could do the following to completley customise the pipeline.

idx.pipeline.reset()
idx.pipeline.add(fn1, fn2, fn3)

from lunr.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.