Search Not Working in Sharetribe Go version 11 Delayed Deltas

Delayed Deltas searching is not working in Version 11.

Search works just fine after you have run: RAILS_ENV=production bundle exec rake ts:index

That command builds the search indexes over the contents of the database.

After that you start the delayed deltas job: RAILS_ENV=production bundle exec rake ts:start

The delayed deltas job works with the worker job to maintain the deltas: RAILS_ENV=production bundle exec rake jobs:work

Deltas are used for marketplace additions and modifications since the last time ts:index was run. This allows listings that were just added or modified to be fully searchable right away.

So search is working with Sharetribe Go version 11, but delayed deltas are not as you can see referenced in a recent posting from another user below.

I suspect this is an issue with ThinkingSphynx https://github.com/pat/thinking-sphinx or more likely the ts-delayed-delta gem.

My team has tried everything possible we could think of to solve this issue but have not been able to move forward with Sharetribe Go version 11 as we cannot get delayed deltas working. We had to roll back to Sharetribe Go version 10.3.0.

I know we could just add a chrontab job for ts:index regularly but there are a couple of problems with that. 1) We have thousands of listings so it takes a while to run. 2) It still means that search will not include everything between the times the chronjob runs.

It is my understanding that Sharetribe Go hosted version DOES NOT use Sphinx anymore but rather they use Elastic Search since it connects to other tools they are using. That said the tests for Sphinx are still running successfully even though delayed deltas are not working.

If anyone has any ideas about this or has solved it please let me know. We are willing to chase down leads and post any possible solution the moment we find it and test it.

2 Likes

I just ran into the same problem. Neither search nor filters work for new listings until I rerun the indexer. Will try using Sharetribe 10.3.0, hopefully that will help.

After some investigation, I strongly suspect that the problem is indeed because of Thinking Sphinx.
This commit updated thinking-sphinx gem from 3.3.0 to 5.5.0. Apparently, there was a breaking API change in 5.0.0 release of Thinking Sphinx described in its release notes. Basically, callbacks aren’t added automatically for all ActiveRecord models anymore, you need to add them explicitly. Now, I am not a Ruby developer and I wasn’t sure how to implement that change for Sharetribe, so I searched GitHub for examples of other projects that upgraded Thinking Sphinx to 5.0.0 or higher, hoping to see what changes they had to implement. I found a couple examples of such upgrades: 1, 2. I tried doing the same for Sharetribe and added the following line into custom_field.rb and listing.rb:

ThinkingSphinx::Callbacks.append(self, behaviours: [:sql, :deltas])

That didn’t help though. Maybe somebody more knowledgeable about Ruby will be able to fix search based on these examples - please share the solution if you do.

Actually, I tested it again today and my fix seems to be working. Not sure what was wrong the first time I tested it, maybe something needed to be restarted. I opened a PR with the fix: https://github.com/sharetribe/sharetribe/pull/4389