That seems reasonable.
Another thing to think about, is maybe it is useful to provide some
event metadata to the events that contain information about what
triggered them. Something like a SolrEvent class such that postCommit
looks like
postCommit(SolrEvent evt)
and
public void newSearcher(SolrEvent evt, SolrIndexSearcher newSearcher,
SolrIndexSearcher currentSearcher);
Of course, since SolrEventListener is an interface...
On Sep 25, 2008, at 11:57 PM, Chris Hostetter wrote:
: postCommit/postOptimize callbacks happen after commit/optimize but
before a
: new searcher is opened. Therefore, it is not possible to re-build
spellcheck
: index on those events without opening a IndexReader directly on
the solr
FWIW: I believe it has to work that way because postCommit events
might
modify the index. (but i'm just guessing)
: index. That is why the event listener in SpellCheckComponent uses
the
: newSearcher listener to build on commits.
:
: I don't think there is anything in the API currently to do what
Jason wants.
couldn't the Listener's newSearcher() method just do something like
this...
if (rebuildOnlyAfterOptimize &&
! (newSearcher.getReader().isOptimized() &&
! oldSearcher.getReader().isOptimized()) {
return;
} else {
// current impl
}
...assuming a new "rebuildOnlyAfterOptimize" option was added?
-Hoss