D
D
Daeamon2015-06-18 09:11:02
PHP
Daeamon, 2015-06-18 09:11:02

How to force Sphinx to return only those materials that have all the words from the query?

Hello, I'm trying to make a search that only looks for all the words in a query.
For example, there is a text

The supranational body of the Customs Union may begin its work in 2014. This was told by the head of the Federal Antimonopoly Service (FAS) of Russia Igor Artemyev. "They have not yet entered into their truth, they will enter after the approval of the powers, the methodology for developing competition - it will take another year. I think they will be able to start around 2014," he said.

The search returns this material for the query "Olympic Games 2014" only because it finds 2014 in the text. It should not be so.
Tried like this:
$sql = 'SELECT * FROM '.$db.' WHERE MATCH(\''.$title.'\') LIMIT '.$lim0.', '.$lim1.' OPTION ranker=matchany,max_matches=100000;';

So:
$sql = 'SELECT * FROM '.$db.' WHERE MATCH(\''.$title.'\') LIMIT '.$lim0.', '.$lim1.' OPTION ranker=proximity,max_matches=100000;';

So:
$sql = 'SELECT * FROM '.$db.' WHERE MATCH(\'"'.$title.'"\') LIMIT '.$lim0.', '.$lim1.' OPTION ranker=proximity,max_matches=100000;';

It still gives out some kind of nonsense.
Please help me understand what is the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mgremlin, 2015-06-18
@Daeamon

Try replacing spaces with pluses.

U
umno, 2015-06-18
@umno

Break all the words, wrap them in quotes, and do this:
select...match('"word1" | "word2" | "word3"') option ranker = sph04;
Should help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question