Unable to reset the "schema"

Didier Lafforgue's Avatar

Didier Lafforgue

12 Jul, 2011 08:48 AM

Hi,

I've just installed flying sphinx in one of my heroku apps. Actually, there was an error in my define_index block: I added a field that didn't exist. I fixed it and ran rake fs:rebuild (+ heroku restart). Unfortunately, I keep having the following error:
Sphinx Sphinx Daemon returned error: index product_core: query error: no field 'visible' found in schema

And in my product.rb model, I've got:

define_index do
  indexes name, :sortable => true
  indexes keywords
  indexes catcher

Any thoughts ?
thanks !

Didier

  1. Support Staff 1 Posted by Pat Allan on 12 Jul, 2011 08:55 AM

    Pat Allan's Avatar

    Hi Didier

    Seems like the error is from when you're searching - what's the search query that's causing the error?

    Pat

  2. 2 Posted by Didier Lafforgu... on 12 Jul, 2011 08:56 AM

    Didier Lafforgue's Avatar

    You're right Pat ! My bad, thanks !

  3. Support Staff 3 Posted by Pat Allan on 12 Jul, 2011 09:02 AM

    Pat Allan's Avatar

    No worries :)

    Pat

  4. Pat Allan closed this discussion on 12 Jul, 2011 09:07 AM.

  5. Didier Lafforgue re-opened this discussion on 12 Jul, 2011 09:13 AM

  6. 4 Posted by Didier Lafforgu... on 12 Jul, 2011 09:13 AM

    Didier Lafforgue's Avatar

    It works now !
    Other question: is there a way to get the generated schema ? Because I had to remove the "has visible" statement (my products sql table does have a visible which is a boolean column) in the define_index because it was causing some problems (cf my initial question).
    I just wanted to check if the rake fs:index includes the visible column in the query.
    thanks !

    p.s.: this application worked well on my custom server. I used thinking-sphinx version 1.2.12

  7. Support Staff 5 Posted by Pat Allan on 12 Jul, 2011 10:54 AM

    Pat Allan's Avatar

    Hi Didier

    You probably didn't see this error on your old server because TS didn't pass on the errors that Sphinx was generating (and possibly Sphinx wasn't as fussy then).

    When you say you'd like to check the schema - do you mean programmatically? For example - to use the filter on visible for some searches but not others? Or would you like to see the generated Sphinx configuration file?

    The latter isn't possible at this point in time (though I'm happy to look at the file myself if you need some feedback for debugging), but as for the latter, you can get access to models' attributes using the following code:

    Product.define_indexes
    Product.sphinx_indexes.first.sources.first.attributes.collect &:unique_name
    
  8. 6 Posted by Didier Lafforgu... on 12 Jul, 2011 08:01 PM

    Didier Lafforgue's Avatar

    Hi Pat !

    Thanks for your help. You are probably right about the hidden error on my server.
    So I read the sphinx doc and I found this: where sanitize_sql(['visible', true])
    it solved my problem !
    You can close the ticket.
    Thank you again so much for your help

    Didier

  9. Pat Allan closed this discussion on 12 Jul, 2011 11:05 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac