mongoid/mongoid_fulltext

Return the `highlight` on search

luizkowalski opened this issue · 3 comments

If you are indexing text, by example, with ElasticSearch, you can get a portion of the text where the search was found, using highlight, so that you can highlight content matching the query.
Would be awesome if mongoid_fulltext could do the same.
Is it possible?

This would be great!

👍

Yes, for searching larger texts this would be awesome. 👍

It's a valid feature request. It needs some thought about how it would be implemented in mongoid_fulltext. To be added to this gem it would need to leverage the database, ie. n-gram data stored has associated metadata that points directly to where the text is located in the text being searched, probably just start and end of the word.