Re: Question on writing custom UpdateHandler

2011-03-01 Thread Chris Hostetter

In your first attempt, the crux of your problem was probably that you were 
never closing the searcher/reader.

: Or how can I perform a query on the current state of the index from within an
: UpdateProcessor?

If you implement UpdateRequestProcessorFactory, the getInstance method is 
given the SolrQueryRequest, which you cna use to access the current 
SolrIndexSearcher.

this will only show you the state of the index as of the last commit, so 
it won't be real time as you are streaming new documents, but if will give 
you the same results as a search query happening concurrent to your 
update.


-Hoss


Re: Question on writing custom UpdateHandler

2011-02-25 Thread Mark
Or how can I perform a query on the current state of the index from 
within an UpdateProcessor?


Thanks

On 2/25/11 6:30 AM, Mark wrote:
I am trying to write my own custom UpdateHandler that extends 
DirectUpdateHandler2.


I would like to be able to query the current state of the index within 
the addDoc method. How would I be able to accomplish this?


I tried something like the following but it was a big fat fail as it 
quickly created an enormous amount of indexes files and I received a 
"too many open files" exception.


/iwCommit.lock();
try {
openWriter();
docs = new IndexSearcher(writer.getReader()).search(query, MAX_DOCS);
} finally {
iwCommit.unlock();
}/

I'm guessing the call to new IndexSearcher is at fault but I'm unsure 
of a way around this.


Thanks for your help!


Question on writing custom UpdateHandler

2011-02-25 Thread Mark
I am trying to write my own custom UpdateHandler that extends 
DirectUpdateHandler2.


I would like to be able to query the current state of the index within 
the addDoc method. How would I be able to accomplish this?


I tried something like the following but it was a big fat fail as it 
quickly created an enormous amount of indexes files and I received a 
"too many open files" exception.


/iwCommit.lock();
try {
openWriter();
docs = new IndexSearcher(writer.getReader()).search(query, MAX_DOCS);
} finally {
iwCommit.unlock();
}/

I'm guessing the call to new IndexSearcher is at fault but I'm unsure of 
a way around this.


Thanks for your help!