You have to set the Hits object to the results of a search. See
Searcher.search()

On Fri, Feb 22, 2008 at 4:32 PM, sumittyagi <[EMAIL PROTECTED]> wrote:

>
> 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 error i am getting is
>
> C:\Documents and Settings\Sumit\Desktop>javac db/comm.java
> db/comm.java:15: variable hits might not have been initialized
> int hitCount = hits.length();
>               ^
> db/comm.java:17: unreported exception java.io.IOException; must be caught
> or
> dec
> lared to be thrown
>   int docId = hits.id(i) ;
>                      ^
> 2 errors
>
>
>
> any help please..
>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-in-Coding%2C-to-get-the-DOC-ID-from-HITS-tp15641665p15641665.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]
>
>

Reply via email to