lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Returning one result
Date Fri, 05 Dec 2003 16:32:22 GMT
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 

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  =;
> Would it have to be something like:
>      TermQuery query = ???

Yes.  TermQuery query = new TermQuery(new Term("id", term));

Use exactly as you did before.  Just don't use 
QueryParser to construct a query.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message