Package org.apache.nutch.webapp.common

Examples of org.apache.nutch.webapp.common.Search


   * @param id key
   * @return
   * @throws NeedsRefreshException
   */
  public Search getSearch(String id, ServiceLocator locator) throws NeedsRefreshException  {
    Search search=null;
   
    ByteBufferWrapper w=(ByteBufferWrapper)cache.getFromCache(id);
    if(w!=null){
     

      try {
        long time=System.currentTimeMillis();
        ByteArrayInputStream is=new ByteArrayInputStream(w.getContents());
        GZIPInputStream gs = new GZIPInputStream(is);
        DataInputStream dis = new DataInputStream(gs);

        search = new Search(locator);
        search.readFields(dis);
        long delta=System.currentTimeMillis()-time;
       
        if(LOG.isDebugEnabled()){
          LOG.debug("Decompressing cache entry took: " + delta + "ms.");
        }

        search.init();
      } catch (IOException e) {
        LOG.info("Could not get cached object: " + e);
      }
    }
    return search;
View Full Code Here


  public void nutchPerform(ComponentContext tileContext,
      HttpServletRequest request, HttpServletResponse response,
      ServletContext servletContext) throws ServletException, IOException {

    ServiceLocator locator = getServiceLocator(request);
    Search search;
   
    // key used for caching results, should really be something else but a part of user
    // definable String
    String key = request.getQueryString().replace("?","_").replace("&","_");
    StringBuffer cacheKey=new StringBuffer(key.length()*2);
 
View Full Code Here

      ServletContext servletContext)
      throws ServletException, IOException {

    ServiceLocator locator = getServiceLocator(request);

    Search search = locator.getSearch();
    search.launchSearch();
  }
View Full Code Here

TOP

Related Classes of org.apache.nutch.webapp.common.Search

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.