Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@apache.org Received: (qmail 66048 invoked from network); 2 Aug 2003 07:26:21 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 2 Aug 2003 07:26:21 -0000 Received: (qmail 983 invoked by uid 97); 2 Aug 2003 07:29:08 -0000 Delivered-To: qmlist-jakarta-archive-lucene-user@nagoya.betaversion.org Received: (qmail 976 invoked from network); 2 Aug 2003 07:29:08 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 2 Aug 2003 07:29:08 -0000 Received: (qmail 65380 invoked by uid 500); 2 Aug 2003 07:26:13 -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 65369 invoked from network); 2 Aug 2003 07:26:13 -0000 Received: from unknown (HELO levi.com) (155.57.254.3) by daedalus.apache.org with SMTP; 2 Aug 2003 07:26:13 -0000 Received: from ([172.23.246.206]) by sfoexironmail.levi.com with ESMTP ; Sat, 02 Aug 2003 00:25:43 -0700 (PDT) Received: by SFOEXIMS with Internet Mail Service (5.5.2656.59) id ; Sat, 2 Aug 2003 00:26:02 -0700 Message-ID: From: MMachado@LEVI.com To: lucene-user@jakarta.apache.org Subject: RE: Problem in getting hits Date: Sat, 2 Aug 2003 00:26:02 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi M P, Is not StringReader but new InputStreamReader. Try this: public void indexFile(String filename) throws Exception { IndexWriter writer; writer = new IndexWriter(path, new SimpleAnalyzer(), false); InputStream is = new FileInputStream(filename); Document doc = new Document(); doc.add(Field.UndIndexed("path", filename)); doc.add(Field.Text("body", (Reader) new InputStreamReader(is))); writer.addDocument(doc); is.close(); writer.close(); } Good Luck Michel -----Original Message----- From: M P [mailto:mp2002003@yahoo.com] Sent: Saturday, August 02, 2003 7:54 AM To: Lucene Users List Subject: RE: Problem in getting hits Hi Michel, I re-indexed the document as you mentioned: doc.add(Field.text("body", new java.io.StringReader(); But, I'm still getting zero hits. Thanks, MP. --- MMachado@LEVI.com wrote: > > > 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))); > > > Michel > -----Original Message----- > From: M P [mailto:mp2002003@yahoo.com] > Sent: Saturday, August 02, 2003 5:25 AM > To: lucene-user@jakarta.apache.org > Subject: Problem in getting hits > > Hello all, > > I'm not getting hits for queries that I think should > return hits. > > Description: > > I have created index with document having terms > "body" > & "title" using StandardAnalyzer. Term "body" is > added > to document as Field.Text("body", ) and Term > title is added as Field.Keyword("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>, > StandardAnalyzer); > > 2. Using PhraseQuery: > > TokenStream tokenizer = > StandardAnalyzer.tokenStream(key, new > java.io.StringReader(<body-text>)); > Token token; > PhraseQuery pq = new PhraseQuery(); > while ((token = tokenizer.next()) != null) > pq.add(new Term("body", token.termText())); > pq.setSlop(50); > > My understanding is that Lucene should return this > document as hit. Please let me know where I'm doing > wrong. > > However, search on the title returns correct hit. > > Any help on this would be really appreciated. > > Thanks, > > MP > > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site > design software > http://sitebuilder.yahoo.com > > --------------------------------------------------------------------- > 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 > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --------------------------------------------------------------------- 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