lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Problem in Coding, to get the DOC ID from HITS
Date Sat, 23 Feb 2008 22:24:57 GMT
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 <ping.sumit@gmail.com> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message