You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by Developer Developer <de...@gmail.com> on 2007/12/05 18:38:56 UTC

Question on searching nutch from java appliction

Hello,

I have a requirement to search nutch index from Java application ( non web).
Here is the code I am using but I get errors. Please help.

Code:
public class TestSearch {

    /**
     * @param args
     */
    public static void main(String[] args)

    {
        try {
            Configuration conf = NutchConfiguration.create();
            IndexSearcher searcher = new IndexSearcher(new
Path("C:\\nutch\\nutch-0.8.1\\crawl\\indexes\\part-00000"), conf);

            //search code to be added


        } catch (IOException e) {

            e.printStackTrace();
        }


    }

}

Error

07/12/05 12:38:06 INFO conf.Configuration: parsing jar:file:/C:/nutch/nutch-
0.8.1/lib/hadoop-0.4.0-patched.jar!/hadoop-default.xml
07/12/05 12:38:06 INFO conf.Configuration: parsing jar:file:/C:/nutch/nutch-
0.8.1/nutch-0.8.1.jar!/nutch-default.xml
07/12/05 12:38:06 INFO conf.Configuration: parsing jar:file:/C:/nutch/nutch-
0.8.1/nutch-0.8.1.jar!/nutch-site.xml
07/12/05 12:38:06 WARN plugin.PluginRepository: Plugins: directory not
found: plugins
07/12/05 12:38:06 INFO plugin.PluginRepository: Plugin Auto-activation mode:
[true]
07/12/05 12:38:06 INFO plugin.PluginRepository: Registered Plugins:
07/12/05 12:38:06 INFO plugin.PluginRepository:     NONE
07/12/05 12:38:06 INFO plugin.PluginRepository: Registered Extension-Points:
07/12/05 12:38:06 INFO plugin.PluginRepository:     NONE
Exception in thread "main" java.lang.RuntimeException:
org.apache.nutch.searcher.QueryFilter not found.
    at org.apache.nutch.searcher.QueryFilters.<init>(QueryFilters.java:59)
    at org.apache.nutch.searcher.IndexSearcher.init(IndexSearcher.java:78)
    at org.apache.nutch.searcher.IndexSearcher.<init>(IndexSearcher.java:70)
    at TestSearch.main(TestSearch.java:19)

Re: Question on searching nutch from java appliction

Posted by Dennis Kubes <ku...@apache.org>.
An easier way would be to create a NutchBean vs the IndexSearcher 
directly.  The error you are getting below though is because you don't 
have a the plugins folder in your classpath.

Dennis

Developer Developer wrote:
> Hello,
> 
> I have a requirement to search nutch index from Java application ( non web).
> Here is the code I am using but I get errors. Please help.
> 
> Code:
> public class TestSearch {
> 
>     /**
>      * @param args
>      */
>     public static void main(String[] args)
> 
>     {
>         try {
>             Configuration conf = NutchConfiguration.create();
>             IndexSearcher searcher = new IndexSearcher(new
> Path("C:\\nutch\\nutch-0.8.1\\crawl\\indexes\\part-00000"), conf);
> 
>             //search code to be added
> 
> 
>         } catch (IOException e) {
> 
>             e.printStackTrace();
>         }
> 
> 
>     }
> 
> }
> 
> Error
> 
> 07/12/05 12:38:06 INFO conf.Configuration: parsing jar:file:/C:/nutch/nutch-
> 0.8.1/lib/hadoop-0.4.0-patched.jar!/hadoop-default.xml
> 07/12/05 12:38:06 INFO conf.Configuration: parsing jar:file:/C:/nutch/nutch-
> 0.8.1/nutch-0.8.1.jar!/nutch-default.xml
> 07/12/05 12:38:06 INFO conf.Configuration: parsing jar:file:/C:/nutch/nutch-
> 0.8.1/nutch-0.8.1.jar!/nutch-site.xml
> 07/12/05 12:38:06 WARN plugin.PluginRepository: Plugins: directory not
> found: plugins
> 07/12/05 12:38:06 INFO plugin.PluginRepository: Plugin Auto-activation mode:
> [true]
> 07/12/05 12:38:06 INFO plugin.PluginRepository: Registered Plugins:
> 07/12/05 12:38:06 INFO plugin.PluginRepository:     NONE
> 07/12/05 12:38:06 INFO plugin.PluginRepository: Registered Extension-Points:
> 07/12/05 12:38:06 INFO plugin.PluginRepository:     NONE
> Exception in thread "main" java.lang.RuntimeException:
> org.apache.nutch.searcher.QueryFilter not found.
>     at org.apache.nutch.searcher.QueryFilters.<init>(QueryFilters.java:59)
>     at org.apache.nutch.searcher.IndexSearcher.init(IndexSearcher.java:78)
>     at org.apache.nutch.searcher.IndexSearcher.<init>(IndexSearcher.java:70)
>     at TestSearch.main(TestSearch.java:19)
>