Package org.apache.solr.common.util

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


  public void finishStage(ResponseBuilder rb) {
  }

    private static void fillResponse(BrowseRequest req,BrowseResult res,SolrQueryResponse solrRsp){
   
    NamedList facetFieldList = new SimpleOrderedMap();
    Map<String,FacetAccessible> facetMap = res.getFacetMap();
   
    Set<Entry<String,FacetAccessible>> entries = facetMap.entrySet();
    for (Entry<String,FacetAccessible> entry : entries){
     
      NamedList facetList = new NamedList();
      facetFieldList.add(entry.getKey(), facetList);
      FacetAccessible facetAccessbile = entry.getValue();
      List<BrowseFacet> facets = facetAccessbile.getFacets();
      for (BrowseFacet facet : facets){
        facetList.add(facet.getValue(),facet.getFacetValueHitCount());
      }
    }
   
    NamedList facetResList = new SimpleOrderedMap();
   
    facetResList.add("facet_fields", facetFieldList);
   
    NamedList facetQueryList = new SimpleOrderedMap();
   
    facetResList.add("facet_queries", facetQueryList);
    solrRsp.add( "facet_counts", facetResList );
   
  }
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    public NamedList getStatistics()
    {
        NamedList lst = new SimpleOrderedMap();

        lst.add("rollbacks", rollbackCommands.get());
        lst.add("adds", addCommands.get());
        lst.add("deletesById", deleteByIdCommands.get());
        lst.add("deletesByQuery", deleteByQueryCommands.get());
        lst.add("errors", numErrors.get());
        lst.add("cumulative_adds", addCommandsCumulative.get());
        lst.add("cumulative_deletesById", deleteByIdCommandsCumulative.get());
        lst.add("cumulative_deletesByQuery", deleteByQueryCommandsCumulative.get());
        lst.add("cumulative_errors", numErrorsCumulative.get());
        return lst;
    }
View Full Code Here

        xw.setIndent(true);
      }
    }

    // dump response values
    NamedList lst = rsp.getValues();
    Boolean omitHeader = req.getParams().getBool(CommonParams.OMIT_HEADER);
    if(omitHeader != null && omitHeader) lst.remove("responseHeader");
    int sz = lst.size();
    int start=0;

    // special case the response header if the version is 2.1 or less   
    if (xw.version<=2100 && sz>0) {
      Object header = lst.getVal(0);
      if (header instanceof NamedList && "responseHeader".equals(lst.getName(0))) {
        writer.write("<responseHeader>");
        xw.incLevel();
        NamedList nl = (NamedList)header;
        for (int i=0; i<nl.size(); i++) {
          String name = nl.getName(i);
          Object val = nl.getVal(i);
          if ("status".equals(name) || "QTime".equals(name)) {
            xw.writePrim(name,null,val.toString(),false);
          } else {
            xw.writeVal(name,val);
          }
View Full Code Here

    QuickHashMap<GroupListCache.GroupList,RefRow> groups=this.makeTopGroups(fields);
    long t3=System.currentTimeMillis();
    this.transGroupValue(groups);
    long t4=System.currentTimeMillis();
   
    NamedList rtn= this.toNameList()
    container.free(groups);
    long t5=System.currentTimeMillis();
    LOG.info("##FacetCross## time taken "+",total:"+(t5-t1)+",init:"+(t2-t1)+",makeGroups:"+(t3-t2)+",transGroupValue:"+(t4-t3)+",groups.size:"+groups.size());
    return rtn;
  }
View Full Code Here

    java.util.ArrayList<GroupbyRow> recommendations = new ArrayList<GroupbyRow>(this.container.res.size());
    recommendations.addAll(this.container.res);
    Collections.sort(recommendations, this.container.cmpString);

    Integer index = 0;
    NamedList res = new NamedList();
    res.add("count", recordCount.toNamedList());
   
    ConcurrentHashMap<Long,String> cache=null;

    boolean issetCrc=this.parse.crcOutputSet!=null;
    MergerGroupByGroupbyRowCompare mergerCmp=null;
    if(issetCrc)
    {
      synchronized (MdrillUtils.CRC_CACHE_SIZE) {
        cache=MdrillUtils.CRC_CACHE_SIZE.get(this.parse.crcOutputSet);
        if(cache==null)
        {
          cache=new ConcurrentHashMap<Long,String>();
          MdrillUtils.CRC_CACHE_SIZE.put(this.parse.crcOutputSet, cache);

        }
      }
     
      FacetComponent.FieldFacet facet=new FacetComponent.FieldFacet(this.parse.params, "solrCorssFields_s");
      mergerCmp=facet.createMergerGroupCmp();
    }
   
    ArrayList<Object> list=new ArrayList<Object>();
   
    for (GroupbyRow kv : recommendations) {
      if (index >= this.parse.offset) {
        if(issetCrc)
        {
          kv.ToCrcSet(mergerCmp,cache);
        }
        list.add(kv.toNamedList());
      }
      index++;
    }
    res.add("list", list);
    return res;
  }
View Full Code Here

      
    int offset = params.getInt(FacetParams.FACET_CROSS_OFFSET, 0);
    int limit = params.getInt(FacetParams.FACET_CROSS_LIMIT, 100);
    int limit_offset = offset + limit;
      
       NamedList fieldCounts = new NamedList();
        GroupbyItem[] counts = dff.getPairSorted(limit_offset);
        if(dff.recordcount!=null)
        {
          GroupbyItem recordcount=dff.recordcount;
          fieldCounts.add("count", recordcount.toNamedList());
        }
      ArrayList<Object> list=new ArrayList<Object>();

        int end = limit_offset> counts.length ?counts.length:limit_offset;
        for (int i=offset; i<end; i++) {
          list.add(counts[i].toNamedList());
        }
       
        fieldCounts.add("list", list);


    return fieldCounts;
  }
View Full Code Here

    FacetInfo fi = rb._facetInfo;
    if(rb.req.getParams().get("mdrill.crc.key.get",null)!=null)
    {
        rb.rsp.add("mdrill_data", rb.crcvalue);
    }else{
      NamedList fieldCounts = new SimpleOrderedMap();
 
      DistribFieldFacet dff=fi.cross;
 
      int saverecords=dff.offset + dff.limit;
      GroupbyItem[] counts = dff.getPairSorted(saverecords);
      if(dff.recordcount!=null)
      {
          GroupbyItem recordcount=dff.recordcount;
        fieldCounts.add("count", recordcount.toNamedList());
      }
 
      int end = dff.limit < 0 ? counts.length : Math.min(dff.offset + dff.limit, counts.length);
    ArrayList<Object> list=new ArrayList<Object>();

      for (int i=dff.offset; i<end; i++) {
        GroupbyItem item=counts[i];
        list.add(item.toNamedList());
      }
      fieldCounts.add("list", list);
      rb.rsp.add("mdrill_data", fieldCounts);
    }


View Full Code Here

   
   
    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)
    {

      String crcliststr=params.get("mdrill.crc.key.get.crclist");
      if(crcliststr!=null)
View Full Code Here

  private NamedList toNameList(PriorityQueue<SelectDetailRow> topItems) {
    java.util.ArrayList<SelectDetailRow> recommendations = new ArrayList<SelectDetailRow>(topItems.size());
    recommendations.addAll(topItems);
    Collections.sort(recommendations, this.container.cmpresult);
    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

   */
  public NamedList getCounts(SolrIndexSearcher searcher, DocSet baseDocs,
      int offset, int limit, Integer mincount, boolean missing,
      String sort, String prefix, Boolean returnPair, boolean isRow)
      throws IOException {
    return new NamedList();
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.common.util.NamedList

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.