[Flask] Odp: Re: Search options for Flask
alex-alex-90 at wp.pl
Tue Sep 13 17:38:25 EDT 2016
Guys, thank you for all your input - I'm reviewing options you've suggested. As a quick fix it turn out that I have been able to make Whoosh working with this package: https://github.com/bkabrda/flask-whooshee. What I really liked about previous approach was __searchable__ attribute. It was IMHO the most simple and clear method enabling full-text search for particular fields within ORM class.
I'm not using sqlite3 only as dev server but actually the client app that works with server app uses it too in order to not to force users to install PostgreSQL. I had similar cases with MySQL - it was catching errors or choking on some request that were fine with sqlite and vice versa while in both cases using Python db api.
I have one more question: I have to store text files inside database. The full-text search function is used to locate simple keywords in those text files. So far I'm just returning the list of files containing particular keyword (just as proof that current solution actually work). How would you implement providing info about particular line(s) containing the keyword. I need to return at least line number with keyword. I am thinking about loading files into memory and scanning them line by line
but maybe there is a better approach. I'm sorry if this sounds like a stupid or trivial question but as I've written before I'm new to such assignment.
Thanks in advance,
More information about the Flask