The segments dir is Nutch only and has nothing to do with the Lucene Index,
which is found at the ${nutch-crawl.dir}/index.
The following lucene code works for me:
Searcher searcher = new IndexSearcher("${nutch-crawl.dir}/index");
I hope this helps.
On 11/29/05, Kasper Hansen <[EMAIL PROTECTED]> wrote:
>
> 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..");
> > }
> > }
>
--
"Minds are like parachutes, they work best when open."
Bruno Patini Furtado
Software Developer
webpage: www.bpfurtado.net
blog: http://www.livejournal.com/users/bpfurtado/