You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Koji Sekiguchi <ko...@r.email.ne.jp> on 2011/03/12 15:50:16 UTC

known problem? - firstSearcher event of SpellChecker is never called

Hello,

I'd like to know if it is a known problem before opening a jira issue,
because I've never used SpellChecker so far and it is not in my line.

firstSearcher event of SpellChecker is never called when there is no
<listener event="firstSearcher"/> registered in solrconfig.xml.

The reason is because the sequence of procedures in SolrCore constructor:

1. initListeners();
2. getSearcher(false,false,null);
   => register (general) firstSearcher listener if it exists
3. call SolrCoreAware.inform();
   => register SpellChecker's firstSearcher listener

After that, Callable.call() is called to execute the firstSearcher event:

if (currSearcher==null && firstSearcherListeners.size() > 0) {
  future = searcherExecutor.submit(
          new Callable() {
            public Object call() throws Exception {
              try {
                for (SolrEventListener listener : firstSearcherListeners) {
                  listener.newSearcher(newSearcher,null);
                }
              } catch (Throwable e) {
                SolrException.logOnce(log,null,e);
              }
              return null;
            }
          }
  );
}

At the time, firstSearcherListeners includes SpellChecker's firstSearcherListner,
registered by procedure 3 above. But if you have no <listener event="firstSearcher"/>
registered in solrconfig.xml, at the procedure 2, searcherExecutor.submit()
is never called because firstSearcherListeners.size() is zero at the moment.

Koji
-- 
http://www.rondhuit.com/en/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: known problem? - firstSearcher event of SpellChecker is never called

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
> Hmmm, this does look like a problem.
> In general, a searcher is opened first, and then inform() is called on
> components.

I like the sequence.

>> At the time, firstSearcherListeners includes SpellChecker's firstSearcherListner,
>> registered by procedure 3 above. But if you have no<listener event="firstSearcher"/>
>> registered in solrconfig.xml, at the procedure 2, searcherExecutor.submit()
>> is never called because firstSearcherListeners.size() is zero at the moment.

I made it was misleading. I think there is a timing issue. Regardless of the existence
of <listener event="firstSearcher"/> in solrconfig.xml, SpellChecker's firstSearcher
listener can never be called, because Callable.call() can be called before executing
SolrCoreAware.inform().

How about moving the following block:

for (SolrEventListener listener : firstSearcherListeners) {
   listener.newSearcher(newSearcher,null);
}

to the end of SolrCore constructor from getSearcher(), because it is for firstSearcher?

Koji
-- 
http://www.rondhuit.com/en/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: known problem? - firstSearcher event of SpellChecker is never called

Posted by Yonik Seeley <yo...@lucidimagination.com>.
Hmmm, this does look like a problem.
In general, a searcher is opened first, and then inform() is called on
components.
Perhaps this should be reversed and inform() should be called first?

To make that happen, we'd need to document that inform() should not
try to get a searcher,
and I think some components may currently do that (like elevation component?)

-Yonik
http://lucidimagination.com

2011/3/12 Koji Sekiguchi <ko...@r.email.ne.jp>:
> Hello,
>
> I'd like to know if it is a known problem before opening a jira issue,
> because I've never used SpellChecker so far and it is not in my line.
>
> firstSearcher event of SpellChecker is never called when there is no
> <listener event="firstSearcher"/> registered in solrconfig.xml.
>
> The reason is because the sequence of procedures in SolrCore constructor:
>
> 1. initListeners();
> 2. getSearcher(false,false,null);
>   => register (general) firstSearcher listener if it exists
> 3. call SolrCoreAware.inform();
>   => register SpellChecker's firstSearcher listener
>
> After that, Callable.call() is called to execute the firstSearcher event:
>
> if (currSearcher==null && firstSearcherListeners.size() > 0) {
>  future = searcherExecutor.submit(
>          new Callable() {
>            public Object call() throws Exception {
>              try {
>                for (SolrEventListener listener : firstSearcherListeners) {
>                  listener.newSearcher(newSearcher,null);
>                }
>              } catch (Throwable e) {
>                SolrException.logOnce(log,null,e);
>              }
>              return null;
>            }
>          }
>  );
> }
>
> At the time, firstSearcherListeners includes SpellChecker's firstSearcherListner,
> registered by procedure 3 above. But if you have no <listener event="firstSearcher"/>
> registered in solrconfig.xml, at the procedure 2, searcherExecutor.submit()
> is never called because firstSearcherListeners.size() is zero at the moment.
>
> Koji
> --
> http://www.rondhuit.com/en/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org