Select/delete all items in Solr
Sebastian Mitroi
To select all items for a field in Solr you can use the query : some_item:[* TO *], but if this field is missing from some documents you will not select those documents.
To select all documents you can use the id defined in /conf/schema.xml, for example: <uniqueKey>solr_id</uniqueKey> you can use solr_id:[* TO *].
Now that you have all documents selected you can delete them :D
To delete all documents in Solr use this update xml:
<delete><query>solr_id:[*TO *]</query></delete>
and of course you have to commit:
<commit />
That’s all !
Posted in General |

May 5th, 2007 at 10:15 pm
The acts as solr schema is a little different. I found my self using
<delete><query>id:[* TO *]</query></delete>
<commit/>
instead
June 25th, 2007 at 4:33 pm
To get all results using acts_as_solr’s find_by_solr (not deleting, just searching), I found “type:[* TO *]” worked fine across all models, though “id:[* TO *]” didn’t. Thanks!