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 org.apache.lucene.search.Hit;
public class comm{
public static void main(String[] args)
{
System.out.println("hi");
Hits hits;
int hitCount = hits.length();
for (int i=0;i<hitCount;i++) {
int docId = hits.id[i] ;
}
}
}
and the errors i am getting are
C:\Documents and Settings\Sumit\Desktop>javac db/comm.java
db/comm.java:20: cannot find symbol
symbol : variable id
location: class org.apache.lucene.search.Hits
int docId = hits.id[i] ;
^
1 error
any advice please....
sumittyagi wrote:
>
> 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;i<hitCount;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 work through the Hits object getting docids are:
>>
>> Hits hits = ...
>> int hitCount = hits.length();
>> for (int i=0;i<hitCount;i++) {
>> int docId = hits.id[i] ;
>> ...
>> }
>>
>> or
>>
>> Iterator hitIterator = hits.iterator() ;
>> while (hitIterator.hasNext()) {
>> Hit hit = (Hit) hitIterator.next() ;
>> int docId = hit.getId() ;
>> }
>>
>> but check out
>> http://lucene.apache.org/java/2_3_0/api/org/apache/lucene/search/Hits.html
>> as this is just code typed into a mail program!
>>
>> Regards,
>>
>> Kent
>>
>> On Fri, Feb 22, 2008 at 4:17 PM, 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 context:
>>> http://www.nabble.com/How-to-get-the-doc-ID-from-HITS-tp15627959p15627959.html
>>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/How-to-get-the-doc-ID-from-HITS-tp15627959p15641410.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]