Reputation: 1524
I am building a full-text search engine that returns results for phrases.
(a) I am trying to match phrases only using SPH_MATCH_PHRASE in SPHINX using PHP. The problem is that when I search for, e.g. "This is a phrase", it also produces relevant results for "This is a phrase" and "a phrase" and "This is a" and "This is" and "phrase" etc. Is there a way to limit results to ONLY the complete phrase?
What I've tried: I searched S/O and found How to query Sphinx for an exact matching phrase? which suggests placing the search query in quotes. I tried it but this returned zero search results when appended to the search terms.
(b) It's my first time using SPHINX, and I have little Linux experience but I managed to get it up and running on a Linux VPS. I started the indexer service but I do not know how to make it re-index all automatically at intervals. Is this a SPHINX configuration or a Linux command?
What I've tried: I searched S/O for (b) above and found this, but for Ruby on Rails thinking sphinx automatic indexing so it didn't help me.
Thanks
Upvotes: 0
Views: 449
Reputation: 1524
Baryhunter's many links and hints in the accepted answer above proved useful. This did the Indexing part for me, in case anyone needs this later on.
/usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf && /usr/local/sphinx/bin/searchd --rotate --config /usr/local/sphinx/etc/sphinx.conf
Upvotes: 0
Reputation: 21091
which suggests placing the search query in quotes.
Yes. Thats for use with Extended Match Mode. SPH_MATCH_EXTENDED
in php make sure you using $cl->setMatchMode() correctly.
I do not know how to make it re-index all automatically at intervals.
Cron. You setup a crontab job to call the indexer program at what ever interval suits your situation.
Upvotes: 1