Of course, these are programming errors nothing really related to Lucene. Hits hits; Int hitCount = hits.length
This does not make sense. You have just declared hits. It must be created before using it. The second error should disapper if you add throws declaration or try/catch block. By the way, avoid asking such questions in this forum because the questions are not related to Lucene!! -----Original Message----- From: sumittyagi [mailto:[EMAIL PROTECTED] Sent: Friday, February 22, 2008 4:32 PM To: java-user@lucene.apache.org Subject: Problem in Coding, to get the DOC ID from HITS 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-t p15641665p15641665.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]