0

For some reason no users that were added to the DB after rake thinking_sphinx:index (or configure) are being displayed. I tried rebooting the server, stopping thinking sphinx then restarting and configuring. Still running into the same issue.

When I run rails c and do User.search I only get the results from the DB that were created before the index/configure was run.

I just flushed out the DB to push this project into production by running.

rake db:reset

Then I rebooted the server and I am running into this issue. When I run the configure I get this in my searchd.log file:

[Tue Jan 15 18:56:02.491 2013] [ 1742] rotating indices (seamless=1)
[Tue Jan 15 18:56:02.499 2013] [ 1742] rotating index 'user_core': success
[Tue Jan 15 18:56:02.506 2013] [ 1742] rotating index 'synonym_delta': success
[Tue Jan 15 18:56:02.512 2013] [ 1742] rotating index 'synonym_core': success
[Tue Jan 15 18:56:02.519 2013] [ 1742] rotating index 'bar_delta': success
[Tue Jan 15 18:56:02.525 2013] [ 1742] rotating index 'bar_core': success
[Tue Jan 15 18:56:02.525 2013] [ 1742] rotating finished

And this in searchd.query.log:

[Tue Jan 15 18:56:06.556 2013] 0.000 sec [ext/2/rel 8 (0,20)] [user_core]
[Tue Jan 15 18:56:06.566 2013] 0.001 sec [ext/2/rel 8 (0,20)] [user_core]
[Tue Jan 15 18:56:06.575 2013] 0.000 sec [ext/2/rel 8 (0,20)] [user_core]

I never had the issue of the search not returning updated results until I flushed the DB and restarted the server. None of the code had been change during that period. Any insight as to what could be the issue would be greatly appreciated. Also if you need more specifics let me know and I can post more. I am reluctant to post too much and overwhelm people from even reading. So let me know what is helpful to have to help better understand my issue.

**What is even weirder is I am not running into this issue with any of the other models, like venues. Which is updated and displayed through the search after it is saved to the DB...

----------------------------Update-----------------------------------

So I ran the rails console, and if I run

User.search

I get 10 results, ending with the last row that was added BEFORE running ts:rebuild. But when I run:

User.all

I get back 11 results, which includes all the rows in the database. Regardless of the last time ts:rebuild / index / configure was run...

Thanks

Alan

Alan DeLonga
  • 454
  • 1
  • 10
  • 27

1 Answers1

1

Perhaps I don't understand. When you build your indices via rake ts:build, and then you have new users that sign up for your web app or whatever, they shouldn't show up in the sphinx index file. The only way they'd show up without you having to do a rake ts:rebuild would be if you were running delta indices, which thinking sphinx supports, and that would create delta index files that would then get merged into your main index files once you do a rake ts:rebuild.

Hassan Shahid
  • 309
  • 2
  • 6
  • So this project was built up by other people and I had to finish it. I have never used thinking_sphinx, but I have been learning as I have been running into issues. There is a delta value set up for users and venues and they are being set to 1 when entries are added. What I don't get is venues is getting updated, it is just the users that is not. – Alan DeLonga Jan 15 '13 at 21:09
  • Are you using Resque or Delayed_job to manage the delta indices? Or I guess the datetime-stamp delta? – Hassan Shahid Jan 15 '13 at 21:18
  • Not 100% sure about this, I am guessing datetime-stamp since all the tables that have a delta field also have fields for created_at and updated_at. Is there somewhere I can look in a config file or a script I can run in the console to let me know which I am using? – Alan DeLonga Jan 15 '13 at 21:21
  • It'd be another gem dependency. You could see in your gem file if you have ts-datetime-delta, or ts-delayed-delta, or ts-resque-delta. – Hassan Shahid Jan 15 '13 at 21:25
  • I don't see any of those in the gemfile... only gem 'thinking-sphinx', '2.0.10' and when I list gems I dont see anything other then thinking-sphinx – Alan DeLonga Jan 15 '13 at 21:47
  • I guess it is set up using the default indexing, not any of the advanced ones referenced here http://pat.github.com/ts/en/deltas.html – Alan DeLonga Jan 15 '13 at 22:04
  • You could turn off the output suppression and ensure that the deltas are actually taking place. – Hassan Shahid Jan 15 '13 at 23:52