lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Problem in getting hits
Date Sat, 02 Aug 2003 05:35:16 GMT

Hi M P,

Try this:

InputStream is = new FileInputStream(filename); where filename is the file
to index.
doc.add(Field.Text("body", (Reader) new InputStreamReader(is)));

-----Original Message-----
From: M P [] 
Sent: Saturday, August 02, 2003 5:25 AM
Subject: Problem in getting hits

Hello all,

I'm not getting hits for queries that I think should
return hits. 


I have created index with document having terms "body"
& "title" using StandardAnalyzer. Term "body" is added
to document as Field.Text("body", <text>) and Term
title is added as Field.Keyword("title", <title>). 

I added a document with body have some 300 words and
title with 2 words.

Next, I searched the index with exactly same body that
I indexed and Lucene returns zero hits. I constructed
query using following different ways:

1. QueryParser.parse("body", <body-text>,

2. Using PhraseQuery:

TokenStream tokenizer =
StandardAnalyzer.tokenStream(key, new<body-text>));
Token token;
PhraseQuery pq = new PhraseQuery();
while ((token = != null) 
pq.add(new Term("body", token.termText()));

My understanding is that Lucene should return this
document as hit. Please let me know where I'm doing

However, search on the title returns correct hit.

Any help on this would be really appreciated.



Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

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

View raw message