Im works with Rails 3 and Sunspot solr 3.5. My application uses Solr to index user-created content and makes it searchable for other users. The goal is to allow users to search for this data as soon as possible from the moment the user downloads it. I do not know if this corresponds to a real-time search.
My application has two models
I index messages, including data from messages, so when a user searches for a specific description provided in a post_item entry, the corresponding post object becomes available when searching.
Users often update post_items, so every time a new post_item is added, I need to reindex the corresponding post object so that the new post_item is available during the search.
So, the moment I get the new post_item object, I run
post_item.post.solr_index! #
which according to this documentation instantly updates the index and commits. This works, but is this the right way to handle indexing in this scenario? I read here that calling an index on a search can break solr. In addition, frequent calls with a manual index are not suitable.
Any suggestions on the right path for this. Are there any alternatives besides switching to ElasticSearch
source
share