lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pleasant, Tracy" <>
Subject RE: Returning one result
Date Fri, 05 Dec 2003 18:25:23 GMT
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

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

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:

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

View raw message