You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@saminzadeh great idea! Unfortunately ItemsJS is using Lunr v1.0.0 and now Lunr is v2.3.3. Hope also Lunr is exposing public function or constructor for changing lunr.tokenizer.seperator. Ideally if simple change with v1.0.0 is possible otherwise ItemsJS should be upgraded to latest Lunr sooner or later. I could hopefully look into it when I find more free time
Nice hack! Integration should be easier than I thought
I am wondering how to test easily separators:
I've test it out with:
varparagraph='The quick brown fox jumped over the lazy dog. It barked.';varregex=/[\s\-[\]:]+/g;varfound=paragraph.split(regex);console.log(found);// ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog.", "It", "barked."]
Testing with Lunr function lunr.tokenizer seems to be more complicated for testing results
I am wondering because if we implement this feature for devs then it could be as separator / regex option or as one of list of predefined analyzers (i.e. like in https://www.elastic.co/guide/en/elasticsearch/reference/2.3/analyzer.html). Second seems nice but first (your suggestion) the simplest to start with and very flexible
Hmm, yes that could be nice. But I agree, would probably want to iron that out a bit more before it is introduced into the API interface.
Second seems nice but first (your suggestion) the simplest to start with and very flexible
Yes I think this could be the best starting point. Just having access to the lunr object via itemsjs would be the most flexible for advanced users and will ensure the correct dependency
Activity
cigolpl commentedon Sep 6, 2018
@saminzadeh great idea! Unfortunately ItemsJS is using Lunr
v1.0.0and now Lunr isv2.3.3. Hope also Lunr is exposing public function or constructor for changinglunr.tokenizer.seperator. Ideally if simple change withv1.0.0is possible otherwise ItemsJS should be upgraded to latest Lunr sooner or later. I could hopefully look into it when I find more free timesaminzadeh commentedon Sep 7, 2018
Sounds good, might take a stab when I get a chance as well.
For now, I did this and it seems to work since it changes the lunr global instance.
cigolpl commentedon Sep 7, 2018
Nice hack! Integration should be easier than I thought
I am wondering how to test easily separators:
I've test it out with:
Testing with
Lunrfunctionlunr.tokenizerseems to be more complicated for testing resultsI am wondering because if we implement this feature for devs then it could be as
separator/ regex option or as one of list of predefined analyzers (i.e. like in https://www.elastic.co/guide/en/elasticsearch/reference/2.3/analyzer.html). Second seems nice but first (your suggestion) the simplest to start with and very flexiblesaminzadeh commentedon Sep 7, 2018
Hmm, yes that could be nice. But I agree, would probably want to iron that out a bit more before it is introduced into the API interface.
Yes I think this could be the best starting point. Just having access to the lunr object via
itemsjswould be the most flexible for advanced users and will ensure the correct dependencySomething like this:
or
cigolpl commentedon Sep 7, 2018
Makes sense!
cigolpl commentedon Apr 9, 2021
@saminzadeh I've introduced simple full text integration with all external search engines in the latest version. You can see here -> https://github.com/itemsapi/itemsjs/blob/master/docs/lunr2-integration.md or in Readme