I'm using Rails with Sunspot gem and Websolr for Solr hosting. Let's say I have a Solr indexed ActiveRecord model like this:
class User < ActiveRecord::Base
searchable do
text :name
end
end
Now I want to remove indexing from this model, so I just remove this indexing code (searchable block). Will the indexed data be removed automatically from Solr? I assume not and that I need to remove/reindex in manually. I can reindex everything like this:
Sunspot.index
Sunspot.commit
But reindexing my whole database will be slow. Is there another - faster way to stop indexing 1 model? I don't see any interface in Websolr to look through and delete records from the index and I can't seem to find any information on how to remove models from indexing with Sunspot.
No, you can't, if you need to reindex again then open Rails console by typing
rails cand thenAnd for the removing indexed data then try to the following
Let's describe on the url part
localhost: is the hostname.8982: port number where your Solr server running if you confusing what is your port number then open rails console and type thisputs Sunspot.config.inspectit will show your port number./solr/default/update: this is the path where your command execute.?commit=true -d: That is the instruction.'<delete><query>*:*</query></delete>': that is the method.I have found this here but it's not working for me because there are port number and path different, I have edited my own way and it's working perfectly.
I think it will help.