You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by si...@apache.org on 2009/02/23 08:02:30 UTC
svn commit: r746900 - in /lucene/nutch/trunk: CHANGES.txt
src/java/org/apache/nutch/searcher/NutchBean.java
Author: siren
Date: Mon Feb 23 07:02:30 2009
New Revision: 746900
URL: http://svn.apache.org/viewvc?rev=746900&view=rev
Log:
NUTCH-694 - Distributed Search Server fails
Modified:
lucene/nutch/trunk/CHANGES.txt
lucene/nutch/trunk/src/java/org/apache/nutch/searcher/NutchBean.java
Modified: lucene/nutch/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/CHANGES.txt?rev=746900&r1=746899&r2=746900&view=diff
==============================================================================
--- lucene/nutch/trunk/CHANGES.txt (original)
+++ lucene/nutch/trunk/CHANGES.txt Mon Feb 23 07:02:30 2009
@@ -351,6 +351,8 @@
131. NUTCH-695 - incorrect mime type detection by MoreIndexingFilter plugin
(Dmitry Lihachev via siren)
+
+132. NUTCH-694 - Distributed Search Server fails (siren)
Release 0.9 - 2007-04-02
Modified: lucene/nutch/trunk/src/java/org/apache/nutch/searcher/NutchBean.java
URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/searcher/NutchBean.java?rev=746900&r1=746899&r2=746900&view=diff
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/searcher/NutchBean.java (original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/searcher/NutchBean.java Mon Feb 23 07:02:30 2009
@@ -48,13 +48,10 @@
// LogFormatter.setShowThreadIDs(true);
// }
- private String[] segmentNames;
-
private SearchBean searchBean;
private SegmentBean segmentBean;
private final HitInlinks linkDb;
-
/** BooleanQuery won't permit more than 32 required/prohibited clauses. We
* don't want to use too many of those. */
private static final int MAX_PROHIBITED_TERMS = 20;
@@ -149,8 +146,8 @@
}
}
- public String[] getSegmentNames() {
- return segmentNames;
+ public String[] getSegmentNames() throws IOException {
+ return segmentBean.getSegmentNames();
}
public Hits search(Query query, int numHits) throws IOException {
@@ -374,17 +371,23 @@
final Configuration conf = NutchConfiguration.create();
final NutchBean bean = new NutchBean(conf);
- final Query query = Query.parse(args[0], conf);
- final Hits hits = bean.search(query, 10);
- System.out.println("Total hits: " + hits.getTotal());
- final int length = (int)Math.min(hits.getTotal(), 10);
- final Hit[] show = hits.getHits(0, length);
- final HitDetails[] details = bean.getDetails(show);
- final Summary[] summaries = bean.getSummary(details, query);
+ try {
+ final Query query = Query.parse(args[0], conf);
+ final Hits hits = bean.search(query, 10);
+ System.out.println("Total hits: " + hits.getTotal());
+ final int length = (int)Math.min(hits.getTotal(), 10);
+ final Hit[] show = hits.getHits(0, length);
+ final HitDetails[] details = bean.getDetails(show);
+ final Summary[] summaries = bean.getSummary(details, query);
- for (int i = 0; i < hits.getLength(); i++) {
- System.out.println(" " + i + " " + details[i] + "\n" + summaries[i]);
+ for (int i = 0; i < hits.getLength(); i++) {
+ System.out.println(" " + i + " " + details[i] + "\n" + summaries[i]);
+ }
+ } catch (Throwable t) {
+ LOG.error("Exception occured while executing search: " + t, t);
+ System.exit(1);
}
+ System.exit(0);
}
public long getProtocolVersion(String className, long clientVersion)
@@ -394,7 +397,7 @@
final RPCSearchBean rpcBean = (RPCSearchBean)searchBean;
return rpcBean.getProtocolVersion(className, clientVersion);
- } else if (SegmentBean.class.getName().equals(className) &&
+ } else if (RPCSegmentBean.class.getName().equals(className) &&
segmentBean instanceof RPCSegmentBean) {
final RPCSegmentBean rpcBean = (RPCSegmentBean)segmentBean;