On 7/24/07, Kai_testing Middleton <[EMAIL PROTECTED]> wrote:
I'm getting this error when I try to run a command line nutch-API based search
app:
IllegalArgumentException: plugin.folders is not defined
Any suggestions?
This is the command:
java -cp <many jars>:$NUTCH_HOME/conf:. SearchApp a_search_string
The default value for "plugin.folders" is "plugins". If you didn't
change it, when you launch nutch, it looks under plugins directory
(relative to directories in classpath, IIRC) and if it can't find it,
throws an exception. You can either add $NUTCH_HOME/build/ to your
classpath or change plugin.folders to $NUTCH_HOME/build/plugins.
I looked at this post:
http://www.mail-archive.com/[email protected]/msg08241.html
and saw advice to put the conf directory in the CLASSPATH, which I did as you
see above, and to also modify nutch-site.xml to contain a line for
plugin.folders, which I also did:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- I'm setting this to an absolute path for the SearchApp sample -->
<property>
<name>plugin.folders</name>
<value>/usr/local/nutch-2007-06-27_06-52-44/plugins</value>
<description>Directories where nutch plugins are located. Each
element may be a relative or absolute path. If absolute, it is used
as is. If relative, it is searched for on the classpath.</description>
</property>
--
Here's SearchApp.java:
import org.apache.hadoop.conf.Configuration;
import java.io.IOException;
import org.apache.nutch.searcher.Hit;
import org.apache.nutch.searcher.HitDetails;
import org.apache.nutch.searcher.Hits;
import org.apache.nutch.searcher.NutchBean;
import org.apache.nutch.searcher.Query;
public class SearchApp {
private static final int NUM_HITS = 10;
public static void main(String[] args)
throws IOException {
if (args.length == 0) {
String usage = "Usage: SearchApp query";
System.err.println(usage);
System.exit(-1);
}
Configuration conf = new Configuration();
NutchBean bean = new NutchBean(conf);
Query query = Query.parse(args[0], conf);
query.addRequiredTerm(args[0]);
Hits hits = bean.search(query, NUM_HITS);
for (int i = 0; i < hits.getLength(); i++) {
Hit hit = hits.getHit(i);
HitDetails details = bean.getDetails(hit);
String title = details.getValue("title");
String url = details.getValue("url");
String summary =
bean.getSummary(details, query).toString();
System.out.print(title);
System.out.print(" (");
System.out.print(url);
System.out.println(")");
System.out.println("\t" + summary);
}
}
}
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
--
Doğacan Güney