Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 44346 invoked from network); 15 Mar 2009 13:38:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Mar 2009 13:38:43 -0000 Received: (qmail 37731 invoked by uid 500); 15 Mar 2009 13:38:36 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 37696 invoked by uid 500); 15 Mar 2009 13:38:36 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 37685 invoked by uid 99); 15 Mar 2009 13:38:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Mar 2009 06:38:36 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aminmc@gmail.com designates 209.85.219.157 as permitted sender) Received: from [209.85.219.157] (HELO mail-ew0-f157.google.com) (209.85.219.157) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Mar 2009 13:38:28 +0000 Received: by ewy1 with SMTP id 1so1404277ewy.5 for ; Sun, 15 Mar 2009 06:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=MS0N9/rOMMZVAx/pDZYRVvz1c1RQNv61gdJzhfGMbNk=; b=WFwwyVYgpr/ESl+x2C4DKCN6QPcJDvTyZcxtnN9pxaIMaTxlsY5HbLFM8p47ezGYND uVV1vWzZGl+vJMa9mk4BoPMUybYTdkhkIY7kFhxrhjJIzZc6lQ3ZAj9AVZAhQzgDT66j GPETPHKn5FeIjB0MWDzxRtQvtkhKR67dTxWFU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=GuDXpz7r8U9k7uYY0C2KhE8NAL1lF03MQusUdXAcoHsRVnUz0/ADmQFrmf3gKeSGUJ 59yIwNp6dpBSoGC1S5Uk2UHWexF/Xl4lB9jjnPhf7beKkLY+GiegtD6oYJWKM6exiZ6J 54EgomLuUL8mv2DNwQ9ly+HBZmw2+y5rKdU1U= MIME-Version: 1.0 Received: by 10.216.8.65 with SMTP id 43mr1424314weq.168.1237124287690; Sun, 15 Mar 2009 06:38:07 -0700 (PDT) In-Reply-To: <179b305e0903150632h35d4b472t8bbb318469ffffaa@mail.gmail.com> References: <179b305e0903150356y1b605a03w2cf4a6b5b5fd38a5@mail.gmail.com> <6f4104d80903150525n798928c0i77e04e543442172@mail.gmail.com> <179b305e0903150549j6b6df95ex8a7e49de9cf0c041@mail.gmail.com> <359a92830903150606m23d12924ofc95d7b5383792f9@mail.gmail.com> <179b305e0903150632h35d4b472t8bbb318469ffffaa@mail.gmail.com> Date: Sun, 15 Mar 2009 13:38:07 +0000 Message-ID: <6f4104d80903150638y6d1ef867x61948d2e5bcaac20@mail.gmail.com> Subject: Re: how to index keyword and value From: Amin Mohammed-Coleman To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=0016364c7a1db5f71004652871f1 X-Virus-Checked: Checked by ClamAV on apache.org --0016364c7a1db5f71004652871f1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit When you create a query to the searcher you can specify which field to search on for example: Query query = queryParser.parse(searchTerm); QueryParser is constructed like this: QueryParser queryParser = new AnalyzingQueryParser("name",new StandardAnalyzer()); Pass the query to the IndexSearcher and you get hits. From the hits you can get the documents and from each matching doucment you can get the phone number field (if you store the number in the index). HTH On Sun, Mar 15, 2009 at 1:32 PM, Seid Mohammed wrote: > dear Erick, that one I have tried the very begining on playing lucene. > I know how to create documents, but my question is I want to create > documents with fields such as person-name and phone-number and so on. > while searching, i will submit a person name so that it will return me > the phone number of that person. > > hope you get my problem > > Thanks a lot > > Seid M > > On 3/15/09, Erick Erickson wrote: > > Have you tried working through the getting started guide at > > http://lucene.apache.org/java/2_4_1/gettingstarted.html? That > > should give you a good idea of how to create a document in Lucene. > > > > > > Best > > Erick > > > > On Sun, Mar 15, 2009 at 8:49 AM, Seid Mohammed > wrote: > > > >> that is exactly my question > >> how can I do that? > >> > >> thanks a lot > >> Seid M > >> > >> On 3/15/09, Amin Mohammed-Coleman wrote: > >> > Why don't you create a Lucene document that represents a Person and > then > >> > index the fields name, age, phone number, etc. Search on the name and > >> then > >> > get the corresponding phone number from the search. > >> > Cheers > >> > Amin > >> > > >> > On Sun, Mar 15, 2009 at 10:56 AM, Seid Mohammed > >> wrote: > >> > > >> >> I want to Index Person_Name and associated phone number. > >> >> Example: Abebe ===>+2519112332 > >> >> later, When I search for Abebe, it should display +2519112332 > >> >> any hint > >> >> > >> >> seid M > >> >> > >> >> -- > >> >> "RABI ZIDNI ILMA" > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >> >> For additional commands, e-mail: java-user-help@lucene.apache.org > >> >> > >> >> > >> > > >> > >> > >> -- > >> "RABI ZIDNI ILMA" > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >> For additional commands, e-mail: java-user-help@lucene.apache.org > >> > >> > > > > > -- > "RABI ZIDNI ILMA" > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --0016364c7a1db5f71004652871f1--