0
votes

Firstly, let me say that I know that http://sphinxsearch.com/docs/current.html#conf-sql-attr-string says "strings can only be used for storage and retrieval" and that "They can not participate in expressions, be used for filtering, sorting, or grouping"...

Having said that, using Sphinx 2.0.2, accessing the index via both the SQL interface (on port 9306) as well as via SphinxSE I am able to sort, at least, on a string attribute I have.

So although that doesn't necessarily mean that the documentation is completely wrong, it does leave me with a small amount of hope that I can filter by that string attribute, too.

Unfortunately I don't know if I can, and if I can, I don't know how.

Can someone here please put me out of my misery?

[EDIT]

The attribute is 'mail_street_name' and I've tried filtering it a number of ways. Trying to filter on 'box', for example, in the SphinxSE query string I've tried filter=mail_street_name,box, filter=mail_street_name,"box" and filter=mail_street_name,\'box\' (escaped because it sits inside a string). These queries result in no change to the result set (as if I didn't try and filter on that attribute at all).

With the MySQL connection on port 9306 I've tried WHERE mail_street_name='box', WHERE mail_street_name="box", WHERE mail_street_name=box and using LIKE instead of =, all to be given a syntax error (Error 1064 (42000)) from SphinxQL.

Many thanks.

1
Have you tried filtering it like any other attribute? Both via the API as via SphinxQL? What where the outcomes? - Michiel van Vaardegem
Hi Michiel van Vaardegem: I just edited the question with what I have tried. For what it's worth, I have not tried an API for my language yet, as I was trying to stick to MySQL. Thanks. - Narcissus
I'm afraid I can't help you further then. It looks likes it realy isn't possible.. - Michiel van Vaardegem
Whell... maybe it's possible to create a field for it, you could do a MATCH against it then - Michiel van Vaardegem

1 Answers

1
votes

As I stated in my last comment, you could try defining a field (http://sphinxsearch.com/docs/current.html#conf-sql-field-string).

You could do a WHERE MATCH((@mail_street_name '*box*'))

And according to the documentation, you are still able to sort on it also