Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 64085 invoked from network); 5 Dec 2003 18:25:34 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Dec 2003 18:25:34 -0000 Received: (qmail 71792 invoked by uid 500); 5 Dec 2003 18:25:21 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 71764 invoked by uid 500); 5 Dec 2003 18:25:21 -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 71747 invoked from network); 5 Dec 2003 18:25:20 -0000 Received: from unknown (HELO mailgw3a.lmco.com) (192.35.35.7) by daedalus.apache.org with SMTP; 5 Dec 2003 18:25:20 -0000 Received: from emss04g01.ems.lmco.com ([166.17.13.122]) by mailgw3a.lmco.com (8.11.6p2/8.11.6) with ESMTP id hB5IPOI17479 for ; Fri, 5 Dec 2003 13:25:24 -0500 (EST) Received: from CONVERSION-DAEMON.lmco.com by lmco.com (PMDF V6.1-1X6 #30760) id <0HPF00801PUC2A@lmco.com> for lucene-user@jakarta.apache.org; Fri, 05 Dec 2003 13:25:24 -0500 (EST) Received: from EMSS04I00.us.lmco.com ([166.17.13.135]) by lmco.com (PMDF V6.1-1X6 #30760) with ESMTP id <0HPF003V9PUCOT@lmco.com> for lucene-user@jakarta.apache.org; Fri, 05 Dec 2003 13:25:24 -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 13:25:23 -0500 Date: Fri, 05 Dec 2003 13:25:23 -0500 From: "Pleasant, Tracy" Subject: RE: Returning one result To: Lucene Users List Message-id: <1B76D3F17F4BE44283AD3C1C92AB590B01D1E78F@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: AcO7TYHo1ZsaxDwuT8eqtVOnOdUlowADybtQ content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: X-OriginalArrivalTime: 05 Dec 2003 18:25:23.0991 (UTC) FILETIME=[25F8A270:01C3BB5D] 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 What I meant is. 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. 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. -----Original Message----- From: Erik Hatcher [mailto:erik@ehatchersolutions.com] Sent: Friday, December 05, 2003 11:32 AM To: Lucene Users List Subject: Re: Returning one result On Friday, December 5, 2003, at 10:41 AM, Pleasant, Tracy wrote: > Maybe I should have been more clear. > > static Field Keyword(String name, String value) > Constructs a String-valued Field that is not tokenized, but > is > indexed and stored. > > I need to have it tokenized because people will search for that also > and > it needs to be searchable. Search for *what* also? Tokenized means that it is broken into pieces which will be separate terms. For example: "see spot" is tokenized into "see" and "spot", and searching for either of those terms will match. Just try it and see, please! :) > Should I have two fields - one as a keyword and one as text? Depends on what you're doing... but an "id" field to me indicates Field.Keyword to me, only. > How would I do that when I want to return search results.. > > Searcher searcher = new IndexSearcher("index"); > String term = request.getParameter("id"); > Query query = QueryParser.parse(term, "id", new > StandardAnalyzer()); > > Hits hits = searcher.search(query); > > Would it have to be something like: > TermQuery query = ??? Yes. TermQuery query = new TermQuery(new Term("id", term)); Use searcher.search exactly as you did before. Just don't use QueryParser to construct a query. 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