Skip to content

mengzhuo/sqlalchemy-fulltext-search

Repository files navigation

SQLAlchemy-FullText-Search

https://travis-ci.org/mengzhuo/sqlalchemy-fulltext-search.svg?branch=dev

https://landscape.io/github/mengzhuo/sqlalchemy-fulltext-search/dev/landscape.svg?style=flat

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('Spam', 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