Sphinx index without errors but it doesn't fetch any instance

I have an app using Flying Sphinx on Heroku. Locally, everything works fine. However, when I deploy to production, it cannot fetch any instance.
I've added the Flying Sphinx add on and run heroku run rake fs:index fs:configure with not results
When I check in the dashboard it gives the feeling that everything is alright.
The app is called on Heroku staging-sennheiser-h-c
Please, let me know which info could I provide to make it easier to debug.

Thanks in advance.

  1. Hi Harí

    It looks like there are no Connector, Headset or Device objects in your database - at least, that’s what the output of the fs:index task is saying. Is that correct?

    Cheers

    —
    Pat

  2. Sorry, it must have been because of a new deploy.
    The database now contains instances of three of them. However when indexing or rebuilding it says:
    skipping non-plain index 'connector'...
    skipping non-plain index 'device'...
    skipping non-plain index 'headset'...
    I've researched and I saw it's normal if I'm using delta indexes.

  3. The error is still the same (in case I was not clear enough :)

  4. It’s normal even if you’re not using deltas - nothing to worry about at all :)

  5. Oh, you’re still not seeing search results?

  6. Unfortunately, not... It was the problem I had before (the empty database was only in the moment I posted this)

  7. Hmm. There’s definitely data stored in your Sphinx indices. Can you share the Ruby code of the Thinking Sphinx search query you’re running?

  8. Hi Pat,
    Thanks for answering.
    The code is definitely OK since it works in both development and tests.

    The search would be like:

      def fetch_results
        Device.search(
          ThinkingSphinx::Query.escape(query),
          page: page,
          per_page: per,
          include: [
            :connectors,
            :manufacturer
          ],
          with: {
            sphinx_internal_id: Device.visible.pluck(:id)
          }
        )
      end

    And in my controller I call it:

    @devices = DeviceFinder.new(params: { q: params[:term], per: 10_000 }).result

    This calls fetch_results

    It's running on Rails 3. I've just read your article that for Rails 3 I should use 'flying-sphinx', '0.7.0' and I'm running 1.2.0.
    I'm going to try that :)

  9. 1.2.0 should be okay with Rails 3 - certainly, I can’t spot any issues that are related to the flying-sphinx gem.

    Can you confirm that `Device.visible.pluck(:id)` returns the ids you’re expecting it to? And what query values are you testing this with?

    —
    Pat

  10. I can confirm that Device.visible.pluck(:id) returns the expected values (around 9485)

    I've tried with empty values (in development it returns them correctly) and with some queries like "cisco".

  11. Hmm. I’m running queries directly on your Sphinx daemon and getting results. For example, searching for cisco (without the filter) returns 87 matches (e.g. SELECT * FROM device_core WHERE MATCH('cisco') LIMIT 1000;)

    Can you check in your Rails console that searches without the filter are returning the expected results for you?

  12. I can't believe this. I was missing an env variable.
    Thanks a lot for your time Pat.

  13. No worries, great to hear you’ve got it working now :)

    Any further issues, do let me know! Though it’s just gone 11pm here, so I probably won’t be so prompt to reply in the next several hours :)

  14. Sleep well on Wurundjeri land :)

Reply to this discussion Internal reply only staff will see it

Markdown

Attaching KB article:

» »

Read more…

Attach files

Up to 10MB each.

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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

Recent Discussions