elasticlunr.js icon indicating copy to clipboard operation
elasticlunr.js copied to clipboard

Indicating which field was matched on during search

Open mgramigna opened this issue 6 years ago • 3 comments

Is there any way to know which field was matched on to cause a search result to appear? For example, if I had the following document in the index,

{
  field1: 'some value',
  field2: 'another one'
}

and I run idx.search('some'), it should match on field1. Is there any way to know that it matched on field1 and not field2?

mgramigna avatar Oct 17 '18 20:10 mgramigna

What's your actual use case?

marvinjude avatar Nov 22 '18 13:11 marvinjude

The document(s) returned are the actual matches

marvinjude avatar Nov 22 '18 13:11 marvinjude

That's possible with lunr but unfortunately not this elasticlunr (at least I could not find a way to do it).

Related: #96

groe avatar Nov 30 '18 11:11 groe