Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: (qmail 65877 invoked from network); 27 Apr 2010 09:00:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Apr 2010 09:00:26 -0000 Received: (qmail 45294 invoked by uid 500); 27 Apr 2010 09:00:26 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 45158 invoked by uid 500); 27 Apr 2010 09:00:24 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 45151 invoked by uid 99); 27 Apr 2010 09:00:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 09:00:23 +0000 X-ASF-Spam-Status: No, hits=-1405.9 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 09:00:22 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 03EC416E29; Tue, 27 Apr 2010 09:00:01 +0000 (GMT) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Tue, 27 Apr 2010 09:00:01 -0000 Message-ID: <20100427090001.21302.21641@eos.apache.org> Subject: =?utf-8?q?=5BSolr_Wiki=5D_Update_of_=22ExtractingRequestHandler=22_by_Mar?= =?utf-8?q?cGhorayeb?= Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for chan= ge notification. The "ExtractingRequestHandler" page has been changed by MarcGhorayeb. The comment on this change is: Updated the SolrJ section with multiValued f= ield section.. http://wiki.apache.org/solr/ExtractingRequestHandler?action=3Ddiff&rev1=3D5= 7&rev2=3D58 -------------------------------------------------- // TODO: describe the different ways to send the documents to solr (POST = body, form encoded, remoteStreaming) * curl "http://localhost:8983/solr/update/extract?literal.id=3Ddoc5&defa= ultField=3Dtext" --data-binary @tutorial.html -H 'Content-type:text/html'= = NOTE, this literally streams the file as the body of the POST,= which does not, then, provide info to Solr about the name of the file. + = + =3D=3D SolrJ =3D=3D - * SolrJ: Use the ContentStreamUpdateRequest (see SolrExampleTests.java = for full example):{{{ + Use the ContentStreamUpdateRequest (see SolrExampleTests.java for full ex= ample): + {{{ - ContentStreamUpdateRequest up =3D new ContentStreamUpdateRequest("/up= date/extract"); + ContentStreamUpdateRequest up =3D new ContentStreamUpdateRequest("/update= /extract"); - up.addFile(new File("mailing_lists.pdf")); + up.addFile(new File("mailing_lists.pdf")); - up.setParam("literal.id", "mailing_lists.pdf"); + up.setParam("literal.id", "mailing_lists.pdf"); - up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); + up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); - result =3D server.request(up); + result =3D server.request(up); - assertNotNull("Couldn't upload mailing_lists.pdf", result); + assertNotNull("Couldn't upload mailing_lists.pdf", result); - rsp =3D server.query( new SolrQuery( "*:*") ); + rsp =3D server.query( new SolrQuery( "*:*") ); - Assert.assertEquals( 1, rsp.getResults().getNumFound() ); + Assert.assertEquals( 1, rsp.getResults().getNumFound() ); }}} + = + If you want to set a '''multiValued''' field, use the ''ModifiableSolrPar= ams'' class like this: + {{{ + p =3D new ModifiableSolrParams(); + for(String value : values) { + p.add(ExtractingParams.LITERALS_PREFIX + "field", value); + } + up.setParams(p); + }}} + = + You could also set all of the other literals and parameters in this class= , and then use the ''setParams'' method to apply the changes to your conten= t stream. = =3D Committer Notes =3D =20