I am using dir path: /home/kah/Downloads/nutch-0.7.1/crawl.pdf/
and getting the following exception!

 Exception in thread "main"
 java.io.FileNotFoundException:
 /home/kah/Downloads/nutch-0.7.1/crawl.pdf/segments (Is a directory)


Tirsdag 22 november 2005 13:12 skrev Kasper Hansen:
> Hi,
> I get an Exception when trying to search my Nutch crawl from a standalone
> java app. How do I search the Nutch crawl? Is the path of the index that's
> wrong? When I remove /index from the path I  get:
> Exception in thread "main"
> java.io.FileNotFoundException:
> /home/kah/Downloads/nutch-0.7.1/crawl.pdf/segments (Is a directory)
>
> But I also get an Exception when using
> /home/kah/Downloads/nutch-0.7.1/crawl.pdf/index
> as path to the crawl
>
> import org.apache.lucene.search.IndexSearcher;
> import org.apache.lucene.search.Query;
> import org.apache.lucene.queryParser.QueryParser;
> import org.apache.lucene.analysis.standard.StandardAnalyzer;
> import org.apache.lucene.search.Hits;
> import org.apache.lucene.document.Document;
>
>
> public class SearchCrawl {
>       public static void main(String[] args) throws Exception {
>
>               IndexSearcher indexSearcher = new
> IndexSearcher("/home/kah/Downloads/nutch-0.7.1/crawl.pdf/index");
>               Query query = QueryParser.parse("some search phrase", 
> "content", new
> StandardAnalyzer());
>
>               Hits hits = indexSearcher.search(query);
>
>               for(int i = 0; i > hits.length(); i++) {
>                       Document doc = hits.doc(i);
>                       String title = doc.get(LuceneFieldValues.TITLE);
>                       String content = doc.get(LuceneFieldValues.CONTENT);
>
>                       System.out.println(title+"\t"+content);
>               }
>               System.out.println("Search done..");
>       }
> }

Reply via email to