On Dec 3, 2013, at 8:41 PM, Upayavira <u...@odoko.co.uk> wrote:

> 
> 
> On Tue, Dec 3, 2013, at 03:22 PM, Peyman Faratin wrote:
>> Hi
>> 
>> Is it possible to delete and commit updates to an index inside a custom
>> SearchComponent? I know I can do it with solrj but due to several
>> business logic requirements I need to build the logic inside the search
>> component.  I am using SOLR 4.5.0. 
> 
> That just doesn't make sense. Search components are read only.
> 
i can think of many situations that it makes sense. for instance, you search 
for a document and your index contains many duplicates that only differ by one 
field, such as the time they were indexed (think news feeds from multiple 
sources). So after the search we want to delete the duplicate documents that 
satisfy some policy (here date, but it could be some other policy). 

> What are you trying to do? What stuff do you need to change? Could you
> do it within an UpdateProcessor?

Solution i am working with 

UpdateRequestProcessorChain processorChain = 
rb.req.getCore().getUpdateProcessingChain(rb.req.getParams().get(UpdateParams.UPDATE_CHAIN));
UpdateRequestProcessor processor = processorChain.createProcessor(rb.req, 
rb.rsp);
...
docId = f();
...
DeleteUpdateCommand cmd = new DeleteUpdateCommand(req);
cmd.setId(docId.toString());
processor.processDelete(cmd);


> 
> Upayavira

Reply via email to