Sphinx Mode in Python / SphinxSearch Class

Posted by: scoopseven 12 years, 11 months ago

In order to get Sphinx to work in boolean mode in Python/Django, you need to pass the "mode" argument as it's plain text value to the SphinxSearch class.

    search = SphinxSearch(
                index = 'my_index another_index',
                mode = 'SPH_MATCH_BOOLEAN',
                maxmatches = '1000000'
    )

If you specify mode as it's numeric equivalent (mode = 3, for boolean) Sphinx will throw a "getattr(): attribute name must be string" error (hint, hint).  If you specify "mode = '3'", Sphinx defaults to "SPH_MATCH_ALL," without throwing an error; not too helpful.

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom