views:

254

answers:

1

I'm encountering strange behaviour from thinking_sphinx/sphinx.

My define_index block is about 100 lines, so quite a lot of columns i'm indexing. For full-text searching I only need about 10 attributes, for sorting and filtering I have another approximately 50 columns, mostly floats and integers.

By filtering I mean using the "with" or "without" options.

Searching does not really work consistently. All of a sudden, one attribute fails to filter. Or if I add a new one, it does not work. Only after a lot of tinkering it suddenly starts working. I cannot really reproduce it. Steps I that sometimes lead me to success where:

  • rm -rf db/sphinx
  • change the attribute definition e.g. has some_attribute => has some_attribute, :sortable => true or => has some_attribute, :sortable => true, :as => "some_attribute"
  • restarting the server
  • assigning a new :as name => has some_attribute, :as => "some_attribute_new"

(yes, I did rake ts:rebuild or rake ts:in after every step)

Does anybody else encounter similar problems?

A: 

This sounds a little odd, although I've not heard of someone having such a large number of fields and/or attributes.

When you say mostly floats and integers, what are the rest? In particular, are there string attributes that you're trying to filter on? Because Sphinx can't do that yet (proposed for 0.9.10).

Also, you don't need :sortable => true for attributes - all attributes are sortable.

Beyond that, I'm afraid I don't have much of an idea of what to do next. If you can somehow reliably reproduce the problem (especially on an index with only a handful of fields and indexes), that'd be fantastic.

pat
I just could reproduce the error when moving the not-working attributes up to the beginning of define_index
seb
Now I moved those attributes down again. And it miraculousliy works again.
seb
You don't have any attributes or fields with the same name in the index, do you? And just to confirm, you're trying to filter on integers and/or floats?
pat

related questions