Do you open the searcher / reader after you call commit on the writer? simon
On Wed, Jan 27, 2010 at 12:40 PM, Asif Nawaz <asifna...@hotmail.com> wrote: > > ok. it works when i add commit and close indexes. when open the index file > with Lukes, it shows me the list of documents that were matched. But in my > program it returns no of hits = 0. Why??? > Hits hits = se.performSearch("significance");System.out.println("hits length > = "+ hits.length()); > > > > > > > > > > > >> Date: Wed, 27 Jan 2010 10:45:27 +0100 >> Subject: Re: Index searching problem >> From: simon.willna...@googlemail.com >> To: java-user@lucene.apache.org >> >> do you close your index writer or commit it before you open your searcher? >> >> one more thing, if you search for "Hotel" you might not find anything >> if the querystring is not passed through the StandardAnalyzer you use >> for indexing. (well, or another analyzer that does lowercasing). >> BTW. you email is hard to read though - I don't see a single newline. >> >> simon >> >> On Wed, Jan 27, 2010 at 10:40 AM, Asif Nawaz <asifna...@hotmail.com> wrote: >> > >> > i build an index to store 100 docs, each with field author, title and >> > abstract.for (i=0;i<100;i++) {writer = new IndexWriter("index",new >> > StandardAnalyzer(),true,IndexWriter.MaxFieldLength.UNLIMITED); >> > doc.add(new Field("author",cfcDoc.getAu(), Field.Store.YES, >> > Field.Index.TOKENIZED));doc.add(new Field("title",cfcDoc.getTi(), >> > Field.Store.YES, Field.Index.TOKENIZED));doc.add(new >> > Field("abstract",cfcDoc.getAb(), Field.Store.YES, >> > Field.Index.TOKENIZED));writer.addDocument(doc);} >> > But when i perfrom a search, it returns zero results, even querystring >> > exist in one of the field of document. why is it so????? >> > Hits hits = se.performSearch("Hotel");System.out.println("hits length = "+ >> > hits.length()); >> > It creates index folder in file system, but when i open the file _0.fdt or >> > _0.fdx with Luke. this shows nothing... it also deletes the file from file >> > system. >> > >> > >> > >> > >> > >> > >> > Asif >> > >> > >> > _________________________________________________________________ >> > Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. >> > https://signup.live.com/signup.aspx?id=60969 >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> > > _________________________________________________________________ > Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. > https://signup.live.com/signup.aspx?id=60969 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org