Package org.archive.wayback.core

Examples of org.archive.wayback.core.SearchResult


  }

  private SearchResult elementToSearchResult(Element e)
    throws ResourceIndexNotAvailableException {

    SearchResult result = new SearchResult();

    String arcFile = getNodeNutchContent(e,NUTCH_ARCNAME);
    if (arcFile!=null) {
      result.put(WaybackConstants.RESULT_ARC_FILE,arcFile);
    }
   
        // The date in nutchwax is now named 'tstamp' and its
        // 17 characters rather than 14.  Pass first 14 only.
        String d = getNodeNutchContent(e,NUTCH_ARCDATE);
        if(d == null) {
          d = getNodeNutchContent(e,NUTCH_ARCDATE_ALT);
        }
        if(d == null) {
          throw new ResourceIndexNotAvailableException("Missing arcdate field in search results");
        }
        if (d.length() == 17) {
            d = d.substring(0, 14);
        }
    result.put(WaybackConstants.RESULT_CAPTURE_DATE, d);
   
    //result.put(WaybackConstants.RESULT_HTTP_CODE,getNodeContent(e,""));
    result.put(WaybackConstants.RESULT_HTTP_CODE,NUTCH_DEFAULT_HTTP_CODE);
   
    String digest = getNodeNutchContent(e,NUTCH_DIGEST);
    if (digest!=null) {
      result.put(WaybackConstants.RESULT_MD5_DIGEST, digest);
    }
   
    if (getNodeNutchContent(e,NUTCH_PRIMARY_TYPE)!=null && getNodeNutchContent(e,NUTCH_SUB_TYPE)!=null) {
      result.put(WaybackConstants.RESULT_MIME_TYPE,
        getNodeNutchContent(e,NUTCH_PRIMARY_TYPE) + "/" +
        getNodeNutchContent(e,NUTCH_SUB_TYPE));
    }
   
    String arcOffset = getNodeNutchContent(e,NUTCH_ARCOFFSET);
    if (arcOffset!=null) {
      result.put(WaybackConstants.RESULT_OFFSET, arcOffset);
    }
   
    String host = getNodeNutchContent(e,NUTCH_CAPTURE_HOST);
    if (host!=null) {
      result.put(WaybackConstants.RESULT_ORIG_HOST, host);
    }

    result.put(WaybackConstants.RESULT_REDIRECT_URL,NUTCH_DEFAULT_REDIRECT_URL);
    String url = getAttributeContent(e,NUTCH_CAPTURE_URL,"url");
    if (url!=null) {
      result.put(WaybackConstants.RESULT_URL, url);
    }
   
    /* BUG 0000155 */
    String digestDiff=getNodeNutchContent(e,WaybackConstants.RESULT_DIGEST_DIFF);
    if (digestDiff!=null) {
      result.put(WaybackConstants.RESULT_DIGEST_DIFF, digestDiff);
    }
   
    String docId=getNodeNutchContent(e,NUTCH_DOC_ID);
    if (docId!=null) {
      result.put(WaybackConstants.REQUEST_DOC_ID, docId);
    }
   
    String indexId=getNodeNutchContent(e,NUTCH_INDEX_ID);
    if (indexId!=null) {
      result.put(WaybackConstants.REQUEST_INDEX_ID, indexId);
    }
    /* BUG 0000155 */
   
    return result;
  }
View Full Code Here


    assertTrue("subpath",isBlocked(filter,"www.peagreenboat.com/foo"));
    assertTrue("emptypath",isBlocked(filter,"www.peagreenboat.com/"));
  }
 
  private boolean isBlocked(ObjectFilter<SearchResult> filter, String url) {
    SearchResult result = new SearchResult();
    result.put(WaybackConstants.RESULT_URL,url);
    int filterResult = filter.filterObject(result);
    if(filterResult == ObjectFilter.FILTER_EXCLUDE) {
      return true;
    }
    return false;
View Full Code Here

TOP

Related Classes of org.archive.wayback.core.SearchResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.