You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Peyman Faratin <pe...@gmail.com> on 2013/12/03 16:22:39 UTC

Deleting and committing inside a SearchComponent

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. 

thank you

Re: Deleting and committing inside a SearchComponent

Posted by Erick Erickson <er...@gmail.com>.
I agree with Upayavira. This seems architecturally
questionable.

In your example, the crux of the matter is
"Only differ by one field". Figuring that out is going to
be expensive, are you burdening searches with this
kind of logic?

Why not create a custom update processor that does
this and use such a component? Or build it into
your updates when you ingest the docs? Or build
a signature field and issue a delete by query on that
when you update?

Best,
Erick


On Tue, Dec 3, 2013 at 9:48 PM, Peyman Faratin <pe...@gmail.com>wrote:

>
> On Dec 3, 2013, at 8:41 PM, Upayavira <uv...@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
>
>

Re: Deleting and committing inside a SearchComponent

Posted by Peyman Faratin <pe...@gmail.com>.
On Dec 3, 2013, at 8:41 PM, Upayavira <uv...@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


Re: Deleting and committing inside a SearchComponent

Posted by Upayavira <uv...@odoko.co.uk>.

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.

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

Upayavira