Skip to content

Commit

Permalink
Merge pull request #143 from sashakames/retract_ts_update
Browse files Browse the repository at this point in the history
Retract ts update
  • Loading branch information
sashakames committed Jul 29, 2020
2 parents 54bc7c3 + a2280ce commit 0b4cf59
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/java/main/esg/search/publish/impl/solr/SolrRetractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.Instant;

import java.time.format.DateTimeFormatter;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -78,8 +82,11 @@ public void consume(final Record record) throws Exception {
// also set "latest=false"
String query = "id="+record.getId();
Map<String,String[]> metadata = new HashMap<String,String[]>();
Instant thedate = Instant.now();

metadata.put(QueryParameters.FIELD_RETRACTED, new String[] {"true"} );
metadata.put(QueryParameters.FIELD_LATEST, new String[] {"false"} );
metadata.put(QueryParameters.FIELD_TIMESTAMP_, new String[] {DateTimeFormatter.ISO_INSTANT.format(thedate)} );
HashMap<String, Map<String,String[]>> doc = new HashMap<String, Map<String,String[]>>();
doc.put(query, metadata);
updateService.update(solrUrl.toString(),
Expand Down

0 comments on commit 0b4cf59

Please sign in to comment.