Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 18521 invoked from network); 5 Dec 2003 19:45:46 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Dec 2003 19:45:46 -0000 Received: (qmail 11584 invoked by uid 500); 5 Dec 2003 19:45:32 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 11376 invoked by uid 500); 5 Dec 2003 19:45:31 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 11362 invoked from network); 5 Dec 2003 19:45:31 -0000 Received: from unknown (HELO mailgw3a.lmco.com) (192.35.35.7) by daedalus.apache.org with SMTP; 5 Dec 2003 19:45:31 -0000 Received: from emss04g01.ems.lmco.com ([166.17.13.122]) by mailgw3a.lmco.com (8.11.6p2/8.11.6) with ESMTP id hB5JjZI09609 for ; Fri, 5 Dec 2003 14:45:35 -0500 (EST) Received: from CONVERSION-DAEMON.lmco.com by lmco.com (PMDF V6.1-1X6 #30760) id <0HPF00601TJZFN@lmco.com> for lucene-user@jakarta.apache.org; Fri, 05 Dec 2003 14:45:35 -0500 (EST) Received: from EMSS04I00.us.lmco.com ([166.17.13.135]) by lmco.com (PMDF V6.1-1X6 #30760) with ESMTP id <0HPF0070JTJZEY@lmco.com> for lucene-user@jakarta.apache.org; Fri, 05 Dec 2003 14:45:35 -0500 (EST) Received: from EMSS04M14.us.lmco.com ([162.16.20.50]) by EMSS04I00.us.lmco.com with Microsoft SMTPSVC(5.0.2195.2966); Fri, 05 Dec 2003 14:45:35 -0500 Date: Fri, 05 Dec 2003 14:45:34 -0500 From: "Pleasant, Tracy" Subject: RE: Returning one result To: Lucene Users List Message-id: <1B76D3F17F4BE44283AD3C1C92AB590B01D1E794@EMSS04M14.us.lmco.com> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft Exchange V6.0.6375.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-Topic: Returning one result Thread-Index: AcO7ZAzUZF8j6zNTRA+nGf1np30UzAAA989A content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: X-OriginalArrivalTime: 05 Dec 2003 19:45:35.0146 (UTC) FILETIME=[59A4A0A0:01C3BB68] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Maybe we are having some communication issues. At any rate, I did index it as a KEYWORD and when displaying used the TermQuery. The only problem with this though is by storing the ID (i.e. AR345) as a Keyword, if I search for AR345 no results are returned when I use the MultiFieldQueryParser . *sigh* *arg* -----Original Message----- From: Erik Hatcher [mailto:erik@ehatchersolutions.com] Sent: Friday, December 05, 2003 2:13 PM To: Lucene Users List Subject: Re: Returning one result On Friday, December 5, 2003, at 01:25 PM, Pleasant, Tracy wrote: > Say ID is Ar3453 .. well the user may want to search for Ar3453, so in > order for it to be searchable then it would have to be indexed and not > a > keyword. *arg* - we're having a serious communication issue here. My advice to you is to actually write some simple tests (test-driven learning using JUnit is a wonderful way to experiement with Lucene, especially thanks to the RAMDirectory). Please refer to my articles at java.net as well as the other great Lucene articles out there. Let me try again.... a Field.Keyword *IS* indexed! Even Lucene's javadocs say this for this method: /** Constructs a String-valued Field that is not tokenized, but is >>>indexed<<< and stored. Useful for non-text fields, e.g. date or url. */ [I added the emphasis there] > So after using > TermQuery query = new TermQuery(new Term("id", term)); > > How would I return the other fields in the document? > > For instance to display a record it would get the record with the id # > and then display the title, contents, etc. Umm.... you'd use *exactly* the same way as if you had used QueryParser. QueryParser would create a TermQuery for you, in fact, except it would analyze your text first, which is what you want to avoid, right? Hits.doc(n) gives you back a Document. And then Document.get("fieldName") gives you back the fields (as long as you >>> stored <<< them in the index too). Again, please attempt some of these things in code. It is a trivial matter to index and search using RAMDirectory and experiment with TermQuery, QueryParser, Analyzers, etc. Erik --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org