Re: FW: Re: lucene3.0.2: getting incorrect no. of occurrence in file

2010-12-08 Thread Erick Erickson
And I kind of skipped over the query part. Between the two of us, we might make one decent code reviewer :D Erick On Wed, Dec 8, 2010 at 8:46 AM, Simon Willnauer < simon.willna...@googlemail.com> wrote: > On Wed, Dec 8, 2010 at 2:43 PM, Erick Erickson > wrote: > > I don't think this code is doi

Re: FW: Re: lucene3.0.2: getting incorrect no. of occurrence in file

2010-12-08 Thread Simon Willnauer
On Wed, Dec 8, 2010 at 2:43 PM, Erick Erickson wrote: > I don't think this code is doing anything predictable. From the javadocs for > TermDocs.skipTo(): > Skips entries to the first beyond the current whose document number is > greater than or equal to *target*. > > Returns true iff there is such

Re: FW: Re: lucene3.0.2: getting incorrect no. of occurrence in file

2010-12-08 Thread Simon Willnauer
Hey there, so let me quickly explain what is going on here. you search for: sql server (without quotes) which QueryParser will turn into a BooleanQuery like sql OR server since the StandardAnalyzer you are using splits on whitespaces. That query will return all document either containing sql or s

Re: FW: Re: lucene3.0.2: getting incorrect no. of occurrence in file

2010-12-08 Thread Erick Erickson
I don't think this code is doing anything predictable. From the javadocs for TermDocs.skipTo(): Skips entries to the first beyond the current whose document number is greater than or equal to *target*. Returns true iff there is such an entry. You're not testing the return value from skipTo. The do

FW: Re: lucene3.0.2: getting incorrect no. of occurrence in file

2010-12-08 Thread Ranjit Kumar
Hi, Thanks for your replay!!! Below is code I am using for search String line="sql server"; IndexReader reader = IndexReader.open(FSDirectory.open(new File(indexpath)), true); // contains index file p