Re: How to get the doc ID from HITS

2008-02-22 Thread sumittyagi
here is my code, i am just starting, so having little bit of trouble in starting, i am just trying to access some values and then want to print it to get started.. here is my code package db; import java.io.*; import java.util.*; import java.lang.*; import org.apache.lucene.search.Hits; import

Re: How to get the doc ID from HITS

2008-02-22 Thread sumittyagi
thanks for replying it may be a silly question but what do in the code Hits hits = ... int hitCount = hits.length(); for (int i=0;ihitCount;i++) { int docId = hits.id[i] ; ... } what do i need to type for . in the 1st line, which is Hits hits = ... Kent Fitch wrote: Two ways to

RE: How to get the doc ID from HITS

2008-02-22 Thread Dharmalingam Ganesan
It should be hits.id(i), not hits.id[i]. Note id is a method not an array. -Original Message- From: sumittyagi [mailto:[EMAIL PROTECTED] Sent: Friday, February 22, 2008 4:06 PM To: java-user@lucene.apache.org Subject: Re: How to get the doc ID from HITS here is my code, i am just

Re: How to get the doc ID from HITS

2008-02-22 Thread ZaeX
Hi, You should get the `Hits' from `IndexSearcher.search(...)' You could refer to the example code in the Lucene source package, or have a look at the book `Lucene in Action' 2008/2/23, sumittyagi [EMAIL PROTECTED]: here is my code, i am just starting, so having little bit of trouble in

Re: How to get the doc ID from HITS

2008-02-21 Thread Gauri Shankar
You should call Hits.id(n) for getting the docId of the nth document. On Fri, Feb 22, 2008 at 10:47 AM, sumittyagi [EMAIL PROTECTED] wrote: hi, is there any way to retrieve the doc ids from HITS, Please advise me regarding this , i am new to lucene and programming. -- View this message in

Re: How to get the doc ID from HITS

2008-02-21 Thread Kent Fitch
Two ways to work through the Hits object getting docids are: Hits hits = ... int hitCount = hits.length(); for (int i=0;ihitCount;i++) { int docId = hits.id[i] ; ... } or Iterator hitIterator = hits.iterator() ; while (hitIterator.hasNext()) { Hit hit = (Hit) hitIterator.next() ;