S
S
Sergey2015-04-12 21:49:59
Sphinx
Sergey, 2015-04-12 21:49:59

How to search for match pairs of occurrences in yii2-sphinx?

There is a table that looks something like this:

id, login_id, address

There can be several addresses (address) for one login (login_id). Well, let's say for a company with login_id = 17 there are two addresses "Moscow" and "New York". All this is indexed by the sphinx.
And now I want to find companies that are located both in Moscow and in New York. In the query I write "Moscow and New York" or "Moscow New York" or "Moscow, New york" - nothing was found. And separately Moscow or New York - finds records successfully. Here is how to search by this principle using sphinx and yii occurrences of addresses?
The code is like this:
$locationquery = $model1->location;
$location = $search->select('id')->from('location')->match($locationquery)->all();

What to use instead of match? Or how to search for everything by feng shui?
Do not split the line into words, do not search for everything found and do not filter ID repetitions for issuance. Or is this the norm in my task?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2015-04-13
@butteff

You need to format the address in the index as MVA
And then it will be possible to search by the exact match of the attribute, and not through the full-text match search (for example: WHERE address="Moscow" AND address="New york")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question