lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriele Kahlout <gabri...@mysimpatico.com>
Subject Re: Can I write to the index from within RequestHandler.handleRequestBody(..)?
Date Sun, 10 Jul 2011 19:45:12 GMT
On Sun, Jul 10, 2011 at 6:21 PM, Koji Sekiguchi <koji@r.email.ne.jp> wrote:

> There are such RequestHandlers. Look at CSVRequestHandler, for example.


>
>              IndexWriter writer = new IndexWriter(FSDirectory.open(**new
>> File(req.getCore().getDataDir(**), "index")),
>> req.getSchema().getAnalyzer(),
>> IndexWriter.MaxFieldLength.**LIMITED);
>>             updateSolrIndex(writer);
>>
>
> Don't use your own writer for same index. Use UpdateRequestProcessor.**processAdd()
> instead.
>
>
What you seem to be suggesting is:

UpdateRequestProcessorChain processorChain =
            req.getCore().getUpdateProcessingChain("WcUpdate");
        UpdateRequestProcessor processor =
processorChain.createProcessor(req, rsp);
try{
        RequestHandlerUtils.handleCommit(processor, params, false);
        RequestHandlerUtils.handleRollback(processor, params, false);
}finally{
    processor.finish();
}

But this is not what I want. I want an IndexWriter instance from which I can
get a reader, the analyzer in use, and the similarity class. If I shall
crease a new IndexWriter for the same index, can I re-use the current one
directly, without the UpdateRequestProcessor interface?

koji
> --
> http://www.rondhuit.com/en/
>



-- 
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
L(-[a-z]+[0-9]X)).

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message