Examples of NamedList


Examples of org.apache.solr.common.util.NamedList

      String hostkey=String.valueOf(this.getkeyCrc());

      ConcurrentHashMap<Long,String> cache=MdrillUtils.CRC_CACHE_SIZE.remove(crcget+"@"+hostkey);

     
      NamedList rtn=new NamedList();
      Map<Long,String> crcvalue=new HashMap<Long,String>();
      rtn.add("fdtcre", crcvalue);
      if(cache!=null)
      {
        MapFieldSelector selector=new MapFieldSelector(fields);
        FieldType[] ftlist=new FieldType[fields.length];
        IndexSchema schema=this.searcher.getSchema();
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

  private NamedList toNameList(PriorityQueue<SelectDetailRow> topItems) {
    java.util.ArrayList<SelectDetailRow> recommendations = new ArrayList<SelectDetailRow>(topItems.size());
    recommendations.addAll(topItems);
    Collections.sort(recommendations,defcmp);
    Integer index = 0;
    NamedList res = new NamedList();
    res.add("count", recordCount.toNamedList());
   
    ConcurrentHashMap<Long,String> cache=null;
    boolean issetCrc=this.parse.crcOutputSet!=null;
    long crckey=this.getkeyCrc();
    if(issetCrc)
    {
      synchronized (MdrillUtils.CRC_CACHE_SIZE) {
        cache=MdrillUtils.CRC_CACHE_SIZE.get(this.parse.crcOutputSet+"@"+crckey);
        if(cache==null)
        {
          cache=new ConcurrentHashMap<Long,String>();
          MdrillUtils.CRC_CACHE_SIZE.put(this.parse.crcOutputSet+"@"+crckey, cache);
        }
      }
     
    }
   
    ArrayList<Object> list=new ArrayList<Object>();

    for (SelectDetailRow kv : recommendations) {
      if (index >= this.parse.offset) {
        if(issetCrc)
        {
          kv.ToCrcSet(cache);
        }
        list.add(kv.toNamedList());
      }
      index++;
    }
    res.add("list", list);
    return res;
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

      setResponseHeaderValues(handler,req,rsp);
     
      if(req.getParams().get("showlog","0").equals("1"))
      {
   // toLog is a local ref to the same NamedList used by the request
      NamedList toLog = rsp.getToLog();
      // for back compat, we set these now just in case other code
      // are expecting them during handleRequest
      toLog.add("webapp", req.getContext().get("webapp"));
      toLog.add("path", req.getContext().get("path"));
      SolrParams params=req.getParams();
      NamedList<Object> p=params.toNamedList();
      p.remove("mdrill.crc.key.get.crclist");
      toLog.add("params", "{" + p.toString() + "}");
      StringBuilder sb = new StringBuilder(logid);
      for (int i=0; i<toLog.size(); i++) {
        String name = toLog.getName(i);
        Object val = toLog.getVal(i);
        sb.append(name).append("=").append(val).append(" ");
      }
      String loginfo=sb.toString();
      log.info(loginfo.substring(0,Math.min(2048, loginfo.length())));
    }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

    execute(handler, req, rsp);
  }
 
  public static void setResponseHeaderValues(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) {
    // TODO should check that responseHeader has not been replaced by handler
  NamedList responseHeader = rsp.getResponseHeader();
    final int qtime=(int)(rsp.getEndTime() - req.getStartTime());
    int status = 0;
    Exception exception = rsp.getException();
    if( exception != null ){
      if( exception instanceof SolrException )
        status = ((SolrException)exception).code();
      else
        status = 500;
    }
    responseHeader.add("status",status);
    responseHeader.add("QTime",qtime);
    rsp.getToLog().add("status",status);
    rsp.getToLog().add("QTime",qtime);
   
    SolrParams params = req.getParams();
    if( params.getBool(CommonParams.HEADER_ECHO_HANDLER, false) ) {
      responseHeader.add("handler", handler.getName() );
    }
   
    // Values for echoParams... false/true/all or false/explicit/all ???
    String ep = params.get( CommonParams.HEADER_ECHO_PARAMS, null );
    if( ep != null ) {
      EchoParamStyle echoParams = EchoParamStyle.get( ep );
      if( echoParams == null ) {
        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid value '" + ep + "' for " + CommonParams.HEADER_ECHO_PARAMS
            + " parameter, use '" + EchoParamStyle.EXPLICIT + "' or '" + EchoParamStyle.ALL + "'" );
      }
      if( echoParams == EchoParamStyle.EXPLICIT ) {
        responseHeader.add("params", req.getOriginalParams().toNamedList());
      } else if( echoParams == EchoParamStyle.ALL ) {
        responseHeader.add("params", req.getParams().toNamedList());
      }
    }
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

  public URL[] getDocs() {
    return null;
  }

  public NamedList getStatistics() {
    NamedList lst = new SimpleOrderedMap();
    lst.add("coreName", name==null ? "(null)" : name);
    lst.add("startTime", new Date(startTime));
    lst.add("refCount", getOpenCount());
//    lst.add("aliases", getCoreDescriptor().getCoreContainer().getCoreNames(this));
    return lst;
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

  public URL[] getDocs() {
    return null;
  }

  public NamedList getStatistics() {
    NamedList lst = new SimpleOrderedMap();
    lst.add("searcherName", name);
    lst.add("numDocs", reader.numDocs());
    lst.add("maxDoc", reader.maxDoc());
    lst.add("reader", reader.toString());
    lst.add("readerDir", reader.directory());
    lst.add("indexVersion", reader.getVersion());
    lst.add("openedAt", new Date(openTime));
    if (registerTime!=0) lst.add("registeredAt", new Date(registerTime));
    lst.add("warmupTime", warmupTime);
    return lst;
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

  static private NamedList readPingQueryParams(SolrConfig config) { 
    String urlSnippet = config.get("admin/pingQuery", "").trim();
   
    StringTokenizer qtokens = new StringTokenizer(urlSnippet,"&");
    String tok;
    NamedList params = new NamedList();
    while (qtokens.hasMoreTokens()) {
      tok = qtokens.nextToken();
      String[] split = tok.split("=", 2);
      params.add(split[0], split[1]);
    }
    if (0 < params.size()) {
      log.warn("The <pingQuery> syntax is deprecated, " +
               "please use PingRequestHandler instead");
    }
    return params;
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

      : Collections.<String>emptySet();

    NamedList<NamedList> analyzeResults = new SimpleOrderedMap<NamedList>();
    if (analysisRequest.getFieldValue() != null) {
      AnalysisContext context = new AnalysisContext(fieldName, fieldType, fieldType.getAnalyzer(), termsToMatch);
      NamedList analyzedTokens = analyzeValue(analysisRequest.getFieldValue(), context);
      analyzeResults.add("index", analyzedTokens);
    }
    if (analysisRequest.getQuery() != null) {
      AnalysisContext context = new AnalysisContext(fieldName, fieldType, fieldType.getQueryAnalyzer());
      NamedList analyzedTokens = analyzeValue(analysisRequest.getQuery(), context);
      analyzeResults.add("query", analyzedTokens);
    }

    return analyzeResults;
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

  }
  public URL[] getDocs() {
    return null;
  }
  public NamedList getStatistics() {
    NamedList stats = new SimpleOrderedMap();
    CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries();
    stats.add("entries_count", entries.length);
    for (int i = 0; i < entries.length; i++) {
      CacheEntry e = entries[i];
      stats.add("entry#" + i, e.toString());
    }

    Insanity[] insanity = checker.check(entries);

    stats.add("insanity_count", insanity.length);
    for (int i = 0; i < insanity.length; i++) {

      /** RAM estimation is both CPU and memory intensive... we don't want to do it unless asked.
      // we only estimate the size of insane entries
      for (CacheEntry e : insanity[i].getCacheEntries()) {
        // don't re-estimate if we've already done it.
        if (null == e.getEstimatedSize()) e.estimateSize();
      }
      **/
     
      stats.add("insanity#" + i, insanity[i].toString());
    }
    return stats;
  }
View Full Code Here

Examples of org.apache.solr.common.util.NamedList

    if (!rb.doStats || (sreq.purpose & ShardRequest.PURPOSE_GET_STATS) == 0) return;

    StatsInfo si = rb._statsInfo;

    for (ShardResponse srsp : sreq.responses) {
      NamedList stats = (NamedList) srsp.getSolrResponse().getResponse().get("stats");

      NamedList stats_fields = (NamedList) stats.get("stats_fields");
      if (stats_fields != null) {
        for (int i = 0; i < stats_fields.size(); i++) {
          String field = stats_fields.getName(i);
          StatsValues stv = si.statsFields.get(field);
          NamedList shardStv = (NamedList) stats_fields.get(field);
          stv.accumulate(shardStv);
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.