I'm having an issue with delta indexing with a single model in my
Rails 2.1 app. I added the delta boolean field to the table, and
added the set_property :delta => true to the define_index block, but
changes to the models don't seem to cause the indexer to be run. If I
manually run the indexer command that it looks like TS should be
generating, then the changes show up. Am I missing a step? Do I
still have to periodically trigger the indexer command to be run?
From the docs and description, I thought that the default behavior was
to automatically kick off the indexer when an AR objection was saved.
Thanks,
Solomon
I had a similar issue with delta search indexing. First, you have to
make sure that index_delta is being called at all, and that the system
call to the indexer command is successful. Unfortunately, the plugin
isn't setup to log any info during this process. Try something like
this:
I didn't actually try this exact code, but it was something very
similar. Be sure to turn on debug logging if you're in production
mode. Or, change `logger.debug` to `logger.warn`. I'm considering
filing a pull request to add some logging to this method. Perhaps
I'll even bust out the open3 lib and only log the STDERR stream.
For what it's worth, my daemon that was running the delta index was
using the /log directory as the current working directory (thank you
daemons gem!). The error I received was due to a missing sphinx
config. I had to ensure my daemon ran from the application root
directory so that the relative sphinx config path would be valid.
--
Rick Olson
http://entp.com
http://lighthouseapp.com
So, it sounds like I was assuming too much on the part of ts. Is the
intent to have the callbacks just flag dirty (from the indexer's pov)
records, then have another process periodically build deltas? After
about two seconds of further consideration, that's probably a better
plan than having every call to AR.save trigger a system call. >:-)
Sent from my iPhone
> So, it sounds like I was assuming too much on the part of ts. Is the
> intent to have the callbacks just flag dirty (from the indexer's pov)
> records, then have another process periodically build deltas? After
> about two seconds of further consideration, that's probably a better
> plan than having every call to AR.save trigger a system call. >:-)
Yeah, you have delta indexes and every now and then you rebuild the
entire index. For some applications it doesn't make sense (or would be
surprising, unexpected, ...) that existing models do not show up in
search results.
Nothing at all? Maybe the after_commit call isn't even working. Go
into script/console and see if the callback is there at all.
"MySearchedModel.after_commit"
If the after_commit call is there but not being called, you may have
to dig in and find out why it's not being called at all.
I index the delta every time a record is update. However, I disabled
the callbacks and perform the indexing in a queue. People tend to
notice if the index isn't updated fairly quickly.
Just to clarify - you have to call the full indexing rake task
manually (or via cron or whatever), but the delta indexes should fire
off automatically - unless you're using one of the forks where it's
been changed to manual?
Give Rick's suggestion with calling after_commit on an instance, see
if that fires off the delta index. It should.
Cheers
--
Pat
Okay, some time in the debugger showed me that the toggle_delta was
getting called, so the flag was getting set, but the index_delta was
never being hit. save_with_after_commit_callback was firing, but it
never made it down to index_delta. I had been meaning to check out
DrMark's fork, since I will need distance with my search results to do
some post-processing, so I updated to that fork, and the problem went
away. Chalk it up to an out-of-date TS, I guess. Thanks for the
suggestions, everyone.
Solomon