Having the FTS engine provide a google-style snippet of the most relevant document chunk is the holy grail for RAG applications. Lucene does this kind of thing better than anyone else:
https://lucene.apache.org/core/8_0_0/highlighter/org/apache/...
It is also very easy to customize this engine and align the document tokenization & indexing concerns with your specific retrieval scenarios.
wredcoll•7h ago
Anyone want to help out?
webstrand•7h ago
Octplane•7h ago
This makes the search less precise and more powerful at the same time (ie it could look clever to some extent).