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 Sujit Pal <su...@comcast.net> on 2011/04/08 01:39:12 UTC

Hook to do stuff when searcher is reopened?

Hi,

I am developing a SearchComponent that needs to build some initial
DocSets and then intersect with the result DocSet during each query (in
process()).

When the searcher is reopened, I need to regenerate the initial DocSets.

I am on Solr 1.4.1.

My question is, which method in SearchComponent should I override to
ensure that this regeneration happens whenever the searcher is reopened
(for example in response to an update followed by a commit)?

If no such hook method exists, how would this need to be done?

Thanks
Sujit



Re: Hook to do stuff when searcher is reopened?

Posted by Sujit Pal <su...@comcast.net>.
Thanks Erick. This looks like it would work... I sent out an update to
my original query, there is another approach that would probably also
work for my case that is being used by SpellCheckerComponent.

I will check out both approaches.

Thanks very much for your help.

-sujit

On Thu, 2011-04-07 at 20:58 -0400, Erick Erickson wrote:
> I haven't built one myself, but have you considered the Solr
> UserCache?
> See: http://wiki.apache.org/solr/SolrCaching#User.2BAC8-Generic_Caches
> 
> 
> It even receives warmup signals I believe...
> 
> 
> Best
> Erick
> 
> On Thu, Apr 7, 2011 at 7:39 PM, Sujit Pal <su...@comcast.net>
> wrote:
>         Hi,
>         
>         I am developing a SearchComponent that needs to build some
>         initial
>         DocSets and then intersect with the result DocSet during each
>         query (in
>         process()).
>         
>         When the searcher is reopened, I need to regenerate the
>         initial DocSets.
>         
>         I am on Solr 1.4.1.
>         
>         My question is, which method in SearchComponent should I
>         override to
>         ensure that this regeneration happens whenever the searcher is
>         reopened
>         (for example in response to an update followed by a commit)?
>         
>         If no such hook method exists, how would this need to be done?
>         
>         Thanks
>         Sujit
>         
>         
> 
> 


Re: Hook to do stuff when searcher is reopened?

Posted by Erick Erickson <er...@gmail.com>.
I haven't built one myself, but have you considered the Solr UserCache?
See: http://wiki.apache.org/solr/SolrCaching#User.2BAC8-Generic_Caches

It even receives warmup signals I believe...

Best
Erick

On Thu, Apr 7, 2011 at 7:39 PM, Sujit Pal <su...@comcast.net> wrote:

> Hi,
>
> I am developing a SearchComponent that needs to build some initial
> DocSets and then intersect with the result DocSet during each query (in
> process()).
>
> When the searcher is reopened, I need to regenerate the initial DocSets.
>
> I am on Solr 1.4.1.
>
> My question is, which method in SearchComponent should I override to
> ensure that this regeneration happens whenever the searcher is reopened
> (for example in response to an update followed by a commit)?
>
> If no such hook method exists, how would this need to be done?
>
> Thanks
> Sujit
>
>
>

Re: Hook to do stuff when searcher is reopened?

Posted by Sujit Pal <su...@comcast.net>.
I think I found the answer by looking through the code...specifically
SpellCheckComponent.

So my component would have to implement SolrCoreAware and in the
inform() method, register a custom SolrEventListener which will execute
the regeneration code in the postCommit and newSearcher methods.

Would still appreciate knowing if there is a simpler way, or if I am
wildly off the mark.

Thanks
Sujit

On Thu, 2011-04-07 at 16:39 -0700, Sujit Pal wrote:
> Hi,
> 
> I am developing a SearchComponent that needs to build some initial
> DocSets and then intersect with the result DocSet during each query (in
> process()).
> 
> When the searcher is reopened, I need to regenerate the initial DocSets.
> 
> I am on Solr 1.4.1.
> 
> My question is, which method in SearchComponent should I override to
> ensure that this regeneration happens whenever the searcher is reopened
> (for example in response to an update followed by a commit)?
> 
> If no such hook method exists, how would this need to be done?
> 
> Thanks
> Sujit
> 
>