lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pleasant, Tracy" <tracy.pleas...@lmco.com>
Subject RE: Returning one result
Date Fri, 05 Dec 2003 15:41:18 GMT
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. 

Should I have two fields - one as a keyword and one as text? 


How would I do that when I want to return search results..

Right now, in the results page it will have something like
<a href="display_record.jsp?id=AR334">Record AR334</a> 

Then in display_record.jsp:
     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 = ???

or 
     Query query = QueryParser.Term("id");

? ? ? 

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Thursday, December 04, 2003 6:18 PM
To: Lucene Users List
Subject: Re: Returning one result


You really should use a TermQuery in this case anyway, rather than 
using QueryParser.  You wouldn't have to worry about the analyzer at 
that point anyway (and I assume you're using Field.Keyword during 
indexing).

	Erik


On Thursday, December 4, 2003, at 05:01  PM, Pleasant, Tracy wrote:

> Ok I realized teh Simple Analyzer does not index numbers, so I
switched
> back to Standard.
>
> -----Original Message-----
> From: Pleasant, Tracy
> Sent: Thursday, December 04, 2003 4:53 PM
> To: Lucene Users List
> Subject: Returning one result
>
>
>  I am indexing a group of items and one field , id, is unique.  When 
> the
> user clicks on a results I want just that one result to show.
>
>  I index and search using SimpleAnalyzer.
>
>
>  Query query_es = QueryParser.parse(query, "id", new
SimpleAnalyzer());
>
>  It should return only one result but returns 200.
>
>
>
>
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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


Mime
View raw message