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 Chris Hostetter <ho...@fucit.org> on 2012/01/06 00:02:17 UTC

Re: [Solr Event Listener plug-in] Execute query search from SolrCore - Java Code

: I have tried to open a new searcher and make a forced commit inside the
: postCommit method of the listener, but it caused many issues.
: How can I complete the commit and then call the postCommit method of the
: listener with the logic inside ( with a lot of queries on the last
: committed docs)?

this is the chicken and the egg problem that i think i mentioned before, 
and the reason why most people deal with this type of situation externally 
from solr -- plugins like UpdateProcessor's can get a searcher fro mthe 
SolrCore, but searchers always represent a snapshot moment in time of the 
most recent commit prior to asking hte SolrCore for that searcher -- they 
don't see any changes being made while the searcher is in use (if they 
did, queries that did things like faceting and highlighting would make no 
sense)

your UpdateProcessor could concievable ask for a new searcher for *every* 
document it wants to check, but that still wouldn't help you find 
doucments that hadn't been commited yet -- the index can't tell you about 
any doc until it's committed.

You either need to keep track of the uncommited docs yourself, or if 
you're willing to depend on Solr trunk and use unreleased 4x code, you 
*might* be able to leverage the "realtime get" stuff that uses a 
transaction log of docs added to make it possible to ask for docs by ID 
even if they haven't been commited yet...

http://www.lucidimagination.com/blog/2011/09/07/realtime-get/
https://wiki.apache.org/solr/RealTimeGet

...but i have no idea if you'll run into any sort of problems reading from 
the transaction log from an UpdateProcessor (not sure what the internal 
API looks like)

-Hoss