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

Confusion in the doc (instantiate/modify/index lunr) #61

Open
natcohen opened this issue Sep 27, 2016 · 5 comments
Open

Confusion in the doc (instantiate/modify/index lunr) #61

natcohen opened this issue Sep 27, 2016 · 5 comments

Comments

@natcohen
Copy link

I'm a little bit confused with lunr implementation in this plugin.

Let me explain...

In the past, I've tried to add multi language support without success ( I'm not using requireJS - using Angular 2 though - and would like to avoid if possible) and I don't really understand how to use pipelines (would like to remove accents when indexing). The problem is that I don't know how to follow lunr tutorials because there is this plugin implementation and it's confusing...

It would be awesome if someone could give me an example of implementation of a pipeline to modify the index (like removing accents) and adding mult-language support (without using requireJS).

We could even add these examples to the documentation....

@natcohen
Copy link
Author

For the multi-language, I've tried the following:

var idx = lunr(function () {
    // use the language (fr)
    this.use(lunr.fr);
});

lunr.multiLanguage('en', 'fr');
lunr.Index.load(idx);

But I get the following error:

Cannot load un-registered function: function (e){var n=e.label&&e.label in t.tokenizer.registeredFunctions;return n||t.utils.warn("Function is not a registered tokenizer. This may cause problems when serialising the index"),this.tokenizerFn=e,this}

For the pipelines, I don't even know how to start...

@natcohen
Copy link
Author

natcohen commented Oct 5, 2016

@nolanlawson A tip (for pipelines and multi-language) would be highly appreciated :)

@nolanlawson
Copy link
Member

The multi-language support was not added by me. There are unit tests that confirm it works, though. I recommend checking out the code and looking at the unit tests to verify that it works. Unfortunately I have very limited time these days and I've had to de-prioritize certain projects, sorry about that.

@natcohen
Copy link
Author

natcohen commented Oct 28, 2016

@nolanlawson Knowing how much you contribute to pouchdb and the other communities, I can easily understand that you have limited time... Hopefully someone else might be able to help me use the pipeline (which is the feature I need the most). Anyway, thank you very much for the hard work!

@carloslfu
Copy link

Hi @natcohen, you can do with a lunr global instance, I think the code you are searching for is this

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