[Flask] Odp: Re: Search options for Flask

Corey Boyle coreybrett at gmail.com
Tue Sep 13 21:18:59 EDT 2016

Store each line as a DB record instead of the whole file as a record?

Or a background worker/queue that inserts files into the database and
indexs them in the process?

On Sep 13, 2016 5:39 PM, "Alex Alex" <alex-alex-90 at wp.pl> wrote:

> 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,
> Alex
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160913/a40886c6/attachment.html>

More information about the Flask mailing list