Deleting multiple Documents at a time, using query, but no Unique ID

923 views
Skip to first unread message

Tiernan OToole

unread,
Jan 22, 2013, 5:42:01 AM1/22/13
to sol...@googlegroups.com
Good morning all.

We have a system, which has 2 sets of IDs. 1 ID uniquely identifies a single record or Solr document, and one could identify multiple items. 

for example:

document1, uniqueID = A1231000, ObjectID = A123
document2, uniqueID = A1231001, ObjectID = A123

the idea is that someone could look for all items with ObjectID A123 and get all records, but the unique ID needs to be Unique (in this case, the ObjectID + the ID in the DB).

Anyway, we need to be able to delete all records for an ObjectID quickly, and ideally, without hitting the DB for all the IDs. 

Currently, looking though code, i can pass in a list of UniqueIDs to be deleted, which would not work easily, plus there could be lots of records for each ID. I could pass in a Query and delete, which would work, but i am looking for the option to send in a list of queries to delete...

the Solr Documentation (http://wiki.apache.org/solr/UpdateXmlMessages#A.22delete.22_documents_by_ID_and_by_Query) does mention that multiple queries can be passed in for delete but SolrNET does not show that in code... Is there something i can do to get this to work? has this been done somewhere else, i should i create a fork?

[mRg]

unread,
Jan 22, 2013, 10:02:12 AM1/22/13
to sol...@googlegroups.com
Delete has several overloads for this .. https://code.google.com/p/solrnet/wiki/CRUD

You can mix lists of Ids with queries if you like ..

Couldnt you just use a SolrQueryInList object .. e.g Delete(SolrQueryInList("ObjectID", "A123", "A124", "A125"));

Apologies if ive mis-understood your question :)


--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To post to this group, send email to sol...@googlegroups.com.
To unsubscribe from this group, send email to solrnet+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/solrnet?hl=en.

Mauricio Scheffer

unread,
Jan 22, 2013, 10:06:39 AM1/22/13
to sol...@googlegroups.com
SolrNet does not support sending multiple queries for delete yet. If you're interested, please fork the repository and implement it. 
Or, as a workaround, you could just send a list of queries joined with an OR which should be the same, or send a SolrQueryInList as mRg suggests for multiple IDs.

Cheers


--
Mauricio


--

Tiernan OToole

unread,
Jan 22, 2013, 10:12:32 AM1/22/13
to sol...@googlegroups.com
Hi Mauricio, I was looking at trying to write code to do the multiple queries, but mRg's answer also makes my life easier... given these queries are simple enough queries, and should all be of the same field, i hope it does the job!

Also, Thanks mRg! That should do what i am looking for!

--Tiernan

[mRg]

unread,
Jan 22, 2013, 10:15:24 AM1/22/13
to sol...@googlegroups.com
No problem :) .. I did think about writing the implementation for this a while ago but TBH ive never ran into a scenario where deleting using a certain type of query didnt do what i wanted.

If not, i'd be interested in the use-case for needing the multiple delete :) 
Reply all
Reply to author
Forward
0 new messages