Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C68976BEC for ; Sun, 10 Jul 2011 19:45:46 +0000 (UTC) Received: (qmail 20495 invoked by uid 500); 10 Jul 2011 19:45:43 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 20250 invoked by uid 500); 10 Jul 2011 19:45:43 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 20242 invoked by uid 99); 10 Jul 2011 19:45:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jul 2011 19:45:42 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,T_FRT_ADULT2 X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.210.176] (HELO mail-iy0-f176.google.com) (209.85.210.176) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jul 2011 19:45:34 +0000 Received: by iyi20 with SMTP id 20so4689103iyi.35 for ; Sun, 10 Jul 2011 12:45:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.94.6 with SMTP id z6mr4774584icm.91.1310327112908; Sun, 10 Jul 2011 12:45:12 -0700 (PDT) Received: by 10.231.15.138 with HTTP; Sun, 10 Jul 2011 12:45:12 -0700 (PDT) X-Originating-IP: [46.18.27.4] In-Reply-To: <4E19D196.2070202@r.email.ne.jp> References: <4E19D196.2070202@r.email.ne.jp> Date: Sun, 10 Jul 2011 21:45:12 +0200 Message-ID: Subject: Re: Can I write to the index from within RequestHandler.handleRequestBody(..)? From: Gabriele Kahlout To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=20cf3036405f1abddf04a7bc4e37 X-Virus-Checked: Checked by ClamAV on apache.org --20cf3036405f1abddf04a7bc4e37 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Jul 10, 2011 at 6:21 PM, Koji Sekiguchi wrote: > There are such RequestHandlers. Look at CSVRequestHandler, for example. > > IndexWriter writer =3D new IndexWriter(FSDirectory.open(**ne= w >> File(req.getCore().getDataDir(**), "index")), >> req.getSchema().getAnalyzer(), >> IndexWriter.MaxFieldLength.**LIMITED); >> updateSolrIndex(writer); >> > > Don't use your own writer for same index. Use UpdateRequestProcessor.**pr= ocessAdd() > instead. > > What you seem to be suggesting is: UpdateRequestProcessorChain processorChain =3D req.getCore().getUpdateProcessingChain("WcUpdate"); UpdateRequestProcessor processor =3D 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 ca= n 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/ > --=20 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) =E2=88=88 L(LON*) =E2=88=A8 =E2=88=83x. (x =E2=88=88 MyInbox = =E2=88=A7 Acknowledges(x, this) =E2=88=A7 time(x) < Now + 48h) =E2=87=92 =C2=ACresend(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". =E2=88=80x. x =E2=88=88 MyInbox =E2=87=92 from(x) =E2=88=88 MySafeSenderLis= t =E2=88=A8 (=E2=88=83y. y =E2=88=88 subject(x) =E2=88=A7 y =E2=88=88 L(-[a-z]+[0-9]X)). --20cf3036405f1abddf04a7bc4e37--