lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <s...@elyograg.org>
Subject Re: using deletebyid with solrj
Date Sun, 21 Apr 2013 14:51:06 GMT
On 4/20/2013 11:21 PM, Tania Marinova wrote:
> so my question is as I have the  abillity to index one partricular row (you saw my code)
how can I reindex in the same way one particular row assuming that I know the id of that row
(so i can select it) so it's no longer indexed in solr. My database is postgresql. 

Your question is confusing, but I am assuming you want to know how to
delete a document in SolrJ.  There are multiple ways to do it.  If the
field that contains the ID you want to delete is the UniqueKey field
that you defined in your schema, you can use deleteById:

String id = "documentA";
server.deleteById(id);

List<String> ids = new ArrayList<String>();
ids.add("documentA");
ids.add("documentB");
server.deleteById(ids);

If the ID you want to delete is in a field other than the UniqueKey
field, you need deleteByQuery:

// OR is included in case you changed the default operator.
// If you didn't change it, then OR is not required.
String query = "field:(documentA OR documentB)";
server.deleteByQuery(query);

Thanks,
Shawn


Mime
View raw message