Find exact word in order in SphinxQL

66 Views Asked by At

I'got got an indexed columns that contains some numbers (ids) and I need to extract rows that match exactly some numbers in a given order.

For example

"Give me rows that contains 1 followed by 1 followed by 25 followed by 30"

1 1 1 2 2 25 25 26 30 31 => is valid

1 1 1 2 2 25 25 26 31 32 => is not valid

1 1 1 2 2 2 2 2 25 30 30 => is valid

I'm trying with 1 >> 1 >> 2 >> 2 but it does not work (I think because it match "1" as single character and not as a "word")

1

There are 1 best solutions below

0
barryhunter On BEST ANSWER

The strict order operator is << , soo

1 << 1 << 25 << 30 

should work.

Matching part words/single charactors (as opposed to whole words) would only work if specifically enabled it, eg with min_infix_len=1 and would probably only match if have enable_keywords=1 (unless sphinx is old enough to have enable_stat=0