Skip to content

placepay/sqlalchemy-fulltext-search

 
 

Repository files navigation

SQLAlchemy-FullText-Search

https://travis-ci.org/mengzhuo/sqlalchemy-fulltext-search.png?branch=master

Fulltext search support with MySQL & SQLAlchemy

Examples:

Default

from sqlalchemy_fulltext import FullText, FullTextSearch
class Foo(FullText, Base):
    __fulltext_columns__ = ('spam', 'ham')

session.query(Foo).filter(FullTextSearch('Spam', Foo))

Using "IN BOOLEAN MODE":

from sqlalchemy_fulltext import FullText, FullTextSearch
import sqlalchemy_fulltext.modes as FullTextMode
class Foo(FullText, Base):
    __fulltext_columns__ = ('spam', 'ham')

session.query(Foo).filter(FullTextSearch('Spa*', Foo, FullTextMode.BOOLEAN))

Using "IN NATURAL LANGUAGE MODE":

from sqlalchemy_fulltext import FullText, FullTextSearch
import sqlalchemy_fulltext.modes as FullTextMode
class Foo(FullText, Base):
    __fulltext_columns__ = ('spam', 'ham')

session.query(Foo).filter(FullTextSearch('Spam', Foo, FullTextMode.NATURAL))

Using "WITH QUERY EXPANSION"

from sqlalchemy_fulltext import FullText, FullTextSearch
import sqlalchemy_fulltext.modes as FullTextMode
class Foo(FullText, Base):
    __fulltext_columns__ = ('spam', 'ham')

session.query(Foo).filter(FullTextSearch('Spam', Foo, FullTextMode.QUERY_EXPANSION))

About

Offering FullText Search of MySQL in SQLAlchemy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%