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

Usage of Lunr js with Turkish language #69

Open
irfancnk opened this issue Jan 20, 2021 · 0 comments
Open

Usage of Lunr js with Turkish language #69

irfancnk opened this issue Jan 20, 2021 · 0 comments

Comments

@irfancnk
Copy link

I am trying to use Lunr library in my nodejs environment. Here is the code block that makes the basic search.

const lunr = require("lunr");
require('lunr-languages/lunr.stemmer.support.js')(lunr);
require('lunr-languages/lunr.tr.js')(lunr);
    
var idx = lunr(function () {
    this.use(lunr.tr);
    this.ref('name');
    this.field('text');
    this.metadataWhitelist = ['position'];
    this.add({
        "name": "./file1.txt",
        "text": "türkçe"
    });
    this.add({
        "name": "./file2.txt",
        "text": "kullanıcı"
    });
});

function searchFor(token) {
    let searchResult = idx.search(`*${token}*`);
    console.log(searchResult.length);
}

searchFor("türkçe")
searchFor("kullanıcı")

The first search hits 1 result as expected. However the second one finds no match. I wonder the reason behind. I have tried using the multi-language as well by adding this.use(lunr.multiLanguage("tr")); and removing this.use(lunr.tr);. Also I tried removing the wildcards * from my search that hits a result but that is not the scenario I need. Is it a problem with the 'tr' support or there is a misunderstanding with my usage?

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

1 participant