Package org.commoncrawl.query

Examples of org.commoncrawl.query.PersistentQueryInfo


   
    // set query info
    queryObject.setClientQueryInfo(theClientRequest);
       
    // now check cache for persistent query cache info ...
    PersistentQueryInfo persistentQueryInfo = getPersistentQueryInfo(queryObject.getCanonicalQueryId(),theClientRequest.getMaxAge());
   
    boolean cachedQueryAvailable = false;
   
    // ok, cached query found ...
    if (persistentQueryInfo != null) {
      LOG.info("Existing Query Id found:" + persistentQueryInfo.getQueryId() + " for Query Request");
      // found cached query... set id of source query object 
      queryObject.setQueryId(persistentQueryInfo.getQueryId());
      // temporarily set the working directory ...
      Path hdfsWorkingDir = new Path(_hdfsResultsDir,Long.toString(queryObject.getQueryId()));
      // and set it into query common info
      queryObject.getCommonQueryInfo().setQueryResultPath(hdfsWorkingDir.toString());
      // try to validate it ..
View Full Code Here


      }
    }
   
    if (bestMatch != null) {
     
      PersistentQueryInfo queryInfo = new PersistentQueryInfo();

      queryInfo.setCannonicalQueryId(getCanonicalIdFromPathString(bestMatch.getPath().getName()));
      queryInfo.setQueryId(getTimestampFromQueryPathString(bestMatch.getPath().getName()));
     
      // if time elapsed since query creation time is less than maxQueryAge threshold ...
      if (System.currentTimeMillis() - queryInfo.getQueryId() < maxAge) {
        return queryInfo;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.commoncrawl.query.PersistentQueryInfo

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.