kaykay-dv / pocketsearch

A simple full-text search library for Python using SQLite and its FTS5 extension
https://pocketsearch.readthedocs.io/en/latest/
MIT License
1 stars 0 forks source link

Support for highlight and snippet function #23

Closed kaykay-dv closed 1 year ago

kaykay-dv commented 1 year ago

sqlite3 supports highlightening search results:

SELECT highlight(email, 2, '<b>', '</b>') FROM email WHERE email MATCH 'fts5'

It would be good to have this available in the API as well, e.g. through this syntax

pocket_search.search(text="hello").values(Highlight("text",2,"<b>","</b>"))

or (which is probably more readable)

pocket_search.search(text="hello").highlight("text",2,"<b>","</b>")
kaykay-dv commented 1 year ago

Implemented in 0.8