Update of /cvsroot/nutch/nutch/src/java/net/nutch/searcher
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13025

Modified Files:
        DistributedSearch.java HitContent.java NutchBean.java 
Log Message:
Add HitContent.getFetchDate() method.

Index: DistributedSearch.java
===================================================================
RCS file: /cvsroot/nutch/nutch/src/java/net/nutch/searcher/DistributedSearch.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** DistributedSearch.java      7 Oct 2004 04:24:53 -0000       1.9
--- DistributedSearch.java      1 Nov 2004 20:23:35 -0000       1.10
***************
*** 33,39 ****
    private static final byte OP_PARSEDATA = (byte)7;
    private static final byte OP_PARSETEXT = (byte)8;
  
    /** Names of the op codes. */
!   private static final String[] OP_NAMES = new String[9];
    static {
      OP_NAMES[OP_SEGMENTS] = "getSegmentNames";
--- 33,40 ----
    private static final byte OP_PARSEDATA = (byte)7;
    private static final byte OP_PARSETEXT = (byte)8;
+   private static final byte OP_FETCHDATE = (byte)9;
  
    /** Names of the op codes. */
!   private static final String[] OP_NAMES = new String[10];
    static {
      OP_NAMES[OP_SEGMENTS] = "getSegmentNames";
***************
*** 46,49 ****
--- 47,51 ----
      OP_NAMES[OP_PARSEDATA] = "getParseData";
      OP_NAMES[OP_PARSETEXT] = "getParseText";
+     OP_NAMES[OP_FETCHDATE] = "getFetchDate";
    }
  
***************
*** 100,107 ****
        case OP_ANCHORS:
        case OP_PARSEDATA:
-         first = new HitDetails();
-         second = NullWritable.get();
-         break;
        case OP_PARSETEXT:
          first = new HitDetails();
          second = NullWritable.get();
--- 102,107 ----
        case OP_ANCHORS:
        case OP_PARSEDATA:
        case OP_PARSETEXT:
+       case OP_FETCHDATE:
          first = new HitDetails();
          second = NullWritable.get();
***************
*** 165,168 ****
--- 165,171 ----
          value = new ParseText();
          break;
+       case OP_FETCHDATE:
+         value = new LongWritable();
+         break;
        default:
          throw new RuntimeException("Unknown op code: " + op);
***************
*** 216,219 ****
--- 219,225 ----
          value = bean.getParseText((HitDetails)p.first);
          break;
+       case OP_FETCHDATE:
+         value = new LongWritable(bean.getFetchDate((HitDetails)p.first));
+         break;
        default:
          throw new RuntimeException("Unknown op code: " + p.op);
***************
*** 451,454 ****
--- 457,468 ----
      }
  
+     public long getFetchDate(HitDetails hit) throws IOException {
+         Param param = new Param(OP_FETCHDATE, hit);
+         InetSocketAddress address =
+           (InetSocketAddress)segmentToAddress.get(hit.getValue("segment"));
+         Result result = (Result)call(param, address);
+         return ((LongWritable)result.value).get();
+     }
+       
      public static void main(String[] args) throws Exception {
        String usage = "DistributedSearch$Client query <host> <port> ...";

Index: NutchBean.java
===================================================================
RCS file: /cvsroot/nutch/nutch/src/java/net/nutch/searcher/NutchBean.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** NutchBean.java      7 Oct 2004 04:24:53 -0000       1.16
--- NutchBean.java      1 Nov 2004 20:23:36 -0000       1.17
***************
*** 252,255 ****
--- 252,259 ----
    }
  
+   public long getFetchDate(HitDetails hit) throws IOException {
+     return content.getFetchDate(hit);
+   }
+ 
    /** For debugging. */
    public static void main(String[] args) throws Exception {

Index: HitContent.java
===================================================================
RCS file: /cvsroot/nutch/nutch/src/java/net/nutch/searcher/HitContent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** HitContent.java     7 Oct 2004 04:24:53 -0000       1.3
--- HitContent.java     1 Nov 2004 20:23:35 -0000       1.4
***************
*** 22,24 ****
--- 22,28 ----
    /** Returns the anchors of a hit document. */
    String[] getAnchors(HitDetails details) throws IOException;
+ 
+   /** Returns the anchors of a hit document. */
+   long getFetchDate(HitDetails details) throws IOException;
+ 
  }



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Nutch-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-cvs

Reply via email to