Package org.apache.nutch.searcher

Examples of org.apache.nutch.searcher.HitDetails


      bean.LOG.info("request from " + request.getRemoteAddr());
    }

    Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),
                      Integer.parseInt(request.getParameter("id")));
    HitDetails details = bean.getDetails(hit);

    // raw bytes
    byte[] bytes = bean.getContent(details);

    // pass all original headers? only these for now.
View Full Code Here


      final Element urlElement = (Element) doc.getElementsByTagName("url").item(0);
      final Element snippetElement = (Element) doc.getElementsByTagName("snippet").item(0);
      final Element titleElement = (Element) doc.getElementsByTagName("title").item(0);

      summaries.add(toText(titleElement) + " " + toText(snippetElement));
      hitDetails.add(new HitDetails(
          new String [] {"url"},
          new String [] {toText(urlElement)}));
    }

    final Clusterer c = new Clusterer();
View Full Code Here

    bean.LOG.info("request from " + request.getRemoteAddr());

    Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),
                      Integer.parseInt(request.getParameter("id")));
    HitDetails details = bean.getDetails(hit);

    // raw bytes
    byte[] bytes = bean.getContent(details);

    // pass all original headers? only these for now.
View Full Code Here

    Summary[] summaries = results.getSummaries();
    for (int i = 0; i < details.length; i++) {
     
      // every document has an indexno and an indexdocno
      JSONObject result = new JSONObject();
      HitDetails detail = details[i];
      Hit hit = hits[i];
      result.accumulate("indexno", hit.getIndexNo());
      result.accumulate("indexkey", hit.getUniqueKey());
     
      // don't add summaries not including summaries
      if (summaries != null && results.isWithSummary()) {
        Summary summary = summaries[i];
        result.accumulate("summary", summary.toString());
      }
     
      // add the fields from hit details
      JSONObject fields = new JSONObject();
      for (int k = 0; k < detail.getLength(); k++) {
        String name = detail.getField(k);
        String[] values = detail.getValues(name);
       
        // if we specified fields to return, only return those fields
        if (fieldSet.size() == 0 || fieldSet.contains(name)) {
          JSONArray valuesAr = new JSONArray();
          for (int m = 0; m < values.length; m++) {
View Full Code Here

          addNode(xmldoc, document, "summary", encSumm);
        }

        // add the fields from hit details
        Element fields = addNode(xmldoc, document, "fields");
        HitDetails detail = details[i];
        for (int j = 0; j < detail.getLength(); j++) {
          String fieldName = detail.getField(j);
          String[] fieldValues = detail.getValues(fieldName);
         
          // if we specified fields to return, only return those fields
          if (fieldSet.size() == 0 || fieldSet.contains(fieldName)) {
            Element field = addNode(xmldoc, fields, "field");
            addAttribute(xmldoc, field, "name", fieldName);
View Full Code Here

      final Element urlElement = (Element) doc.getElementsByTagName("url").item(0);
      final Element snippetElement = (Element) doc.getElementsByTagName("snippet").item(0);
      final Element titleElement = (Element) doc.getElementsByTagName("title").item(0);

      summaries.add(toText(titleElement) + " " + toText(snippetElement));
      hitDetails.add(new HitDetails(
          new String [] {"url"},
          new String [] {toText(urlElement)}));
    }

    final Clusterer c = new Clusterer();
View Full Code Here

      bean.LOG.info("request from " + request.getRemoteAddr());
    }

    Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),
                      Integer.parseInt(request.getParameter("id")));
    HitDetails details = bean.getDetails(hit);

    // raw bytes
    byte[] bytes = bean.getContent(details);

    // pass all original headers? only these for now.
View Full Code Here

TOP

Related Classes of org.apache.nutch.searcher.HitDetails

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.