On 11/12/2011 4:08 PM, mikr00 wrote: > Similar to a first in first out list. The problem is: It's easy to check the > limit, but how can I delete the oldest documents to go again below the > limit? Can I do it with a delete by query request? In that case, I would > probably have to limit the number of rows? But I can't seem to find a way to > do that. Or would you see a different solution (maybe there is a way to > configure the solr core such that it automatically behaves as desribed?)?
You can certainly delete a set of documents using "delete by query", but you need to somehow identify what documents you want to have deleted. For that, you'd need to have a field, such as a sequence number or a timestamp when the document was added. Alternatively, if you can control the uniqueKey field when adding documents, you can just cycle it between 1 and 1,000,000. When you reach 1,000,000 set the uniqueKey back to 1 and keep adding. The new document will automatically replace the old document with the key of "1".