Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to not use default pipeline #50

Closed
hadees opened this issue Oct 3, 2013 · 5 comments
Closed

Make it easier to not use default pipeline #50

hadees opened this issue Oct 3, 2013 · 5 comments

Comments

@hadees
Copy link

hadees commented Oct 3, 2013

It would be nice to be able to pass in some config values instead of having to manually remove the stopWordFilter and stemmer from the pipeline.

@brockfanning
Copy link

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);

@olivernn
Copy link
Owner

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?

@hadees
Copy link
Author

hadees commented Oct 10, 2013

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.

@olivernn
Copy link
Owner

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)

@olivernn
Copy link
Owner

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants