Matching results disappear when expending the term
See original GitHub issueHi Oliver,
I am working with lunr since a couple of week (which I have to say is awesome in term of easy to use, and features). I am having a strange behavior who seems to be similar to something already described in this issue #68
I have entries some containing phone
, others containing iphone
. If I search for phon
, both phone
and iphone
entries are returned. If I search for phone
, only phone
entries are returned.
I am using leading and trailing wildcard on term :
q.term(term, {
boost: 100
})
q.term(term, {
boost: 10,
usePipeline: false,
wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING
})
I tried by adding only with leading wildcard, but results are the same. It can be easily reproduce with this code :
const lunr = require('lunr')
const data = [{name: 'phone'}, {name: 'iphone'}]
const index = lunr(function () {
this.ref('name')
this.field('name')
data.forEach(item => this.add(item))
})
index.search('phone')
// [ { ref: 'phone', score: 1, matchData: { metadata: [Object] } } ]
index.search('iphone')
// [ { ref: 'iphone', score: 1, matchData: { metadata: [Object] } } ]
index.search('*phone')
// [ { ref: 'phone', score: 1, matchData: { metadata: [Object] } } ]
index.search('*phon')
// [ { ref: 'iphone', score: 1, matchData: { metadata: [Object] } } ]
Am I missing something, or is this a bug ? If it’s one, how can I help to solve it ?
Thanks a lot.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Power Query - Row disappear after expand column
Solved: Hello, I have encountered a strange thing when I expand merged table column. I use JoinKind.LeftOuter to merge queries - that should...
Read more >INQUIZITIVE; Chapter 28 Flashcards - Quizlet
The Great Recession was given that name because a recession is a brief contraction in an economy that goes away quickly. This Great...
Read more >Set table cells to expand with contents in Word
Word usually wraps text in a table cell automatically. However, if your rows are set to an exact height, the cells won't expand...
Read more >Frequently Asked Questions — COLMAP 3.8 documentation
Try decreasing the option --SiftMatching.max_num_matches until the error disappears. Note that this might lead to inferior feature matching results, ...
Read more >Create advanced animations with smart animate
With smart animate matching layers, Figma will move or slide in layers based on their hierarchy, which can cause some confusing or unexpected...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@myalgo @mike1808 the test I just added.
@gsavin yeah, stemming is a bit of a black box, I didn’t write the current stemmer, so its even more of a black box. I did think about re-implementing it, if nothing else then to understand the rules a bit more, but time is always in short supply!
@mike1808 regarding the behaviour of the wildcard, I think that is a bug, or at least incorrectly implemented. I took inspiration for the syntax from Lucene and its
*
matches 0 or more, where it looks like Lunr implements it as 1 or more. I’ll take a look at what would be involved in fixing this.