congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.apache.solr.common.util
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.solr.common.util

Best Java code snippets using org.apache.solr.common.util (Showing top 20 results out of 675)

origin: tjake/Solandra

@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;
}
origin: apache/storm

private SolrRequest createtSolrRequest(String json) {
  final ContentStreamUpdateRequest request = new ContentStreamUpdateRequest(jsonUpdateUrl);
  final ContentStream cs = new ContentStreamBase.StringStream(json, CONTENT_TYPE);
  request.addContentStream(cs);
  if (logger.isDebugEnabled()) {
    logger.debug("Request generated with JSON: " + json);
  }
  return request;
}
origin: tjake/Solandra

public static void writeSchema(String indexName, String schemaXml) throws IOException
{        
  writeCoreResource(indexName, CassandraUtils.schemaKey, schemaXml);
  logger.info("Wrote Schema for " + indexName);
  
  //remove any existing cores
  cache.remove(indexName);
}
origin: apache/nifi

private String getFieldNameOfUniqueKey() {
  final SolrQuery solrQuery = new SolrQuery();
  try {
    solrQuery.setRequestHandler("/schema/uniquekey");
    final QueryRequest req = new QueryRequest(solrQuery);
    if (isBasicAuthEnabled()) {
      req.setBasicAuthCredentials(getUsername(), getPassword());
    }
    return(req.process(getSolrClient()).getResponse().get("uniqueKey").toString());
  } catch (SolrServerException | IOException e) {
    getLogger().error("Solr query to retrieve uniqueKey-field failed due to {}", new Object[]{solrQuery.toString(), e}, e);
    throw new ProcessException(e);
  }
}
origin: BroadleafCommerce/BroadleafCommerce

@Override
@SuppressWarnings("unchecked")
public Map<String, SolrJSONFacet> resolveJSONFacetResponse(QueryResponse response) {
  Map<String, SolrJSONFacet> jsonFacetMap = new HashMap<>();
  NamedList facetResponse = (NamedList) response.getResponse().get("facets");
  if (facetResponse != null) {
    Iterator<Map.Entry<String, Object>> facetIterator = facetResponse.iterator();
    while (facetIterator.hasNext()) {
      Map.Entry<String, Object> entry = facetIterator.next();
      if (NamedList.class.isAssignableFrom(entry.getValue().getClass())) {
        jsonFacetMap.put(entry.getKey(), resolveJSONFacet((NamedList) entry.getValue()));
      }
    }
  }
  return jsonFacetMap;
}
origin: org.apache.solr/solr-solrj

public void writeNamedList(NamedList<?> nl) throws IOException {
 writeTag(nl instanceof SimpleOrderedMap ? ORDERED_MAP : NAMED_LST, nl.size());
 for (int i = 0; i < nl.size(); i++) {
  String name = nl.getName(i);
  writeExternString(name);
  Object val = nl.getVal(i);
  writeVal(val);
 }
}
origin: org.apache.solr/solr-solrj

public NamedList<Object> readNamedList(DataInputInputStream dis) throws IOException {
 int sz = readSize(dis);
 NamedList<Object> nl = new NamedList<>(sz);
 for (int i = 0; i < sz; i++) {
  String name = (String) readVal(dis);
  Object val = readVal(dis);
  nl.add(name, val);
 }
 return nl;
}
origin: org.apache.solr/solr-solrj

public SimpleOrderedMap<Object> readOrderedMap(DataInputInputStream dis) throws IOException {
 int sz = readSize(dis);
 SimpleOrderedMap<Object> nl = new SimpleOrderedMap<>(sz);
 for (int i = 0; i < sz; i++) {
  String name = (String) readVal(dis);
  Object val = readVal(dis);
  nl.add(name, val);
 }
 return nl;
}
origin: org.apache.solr/solr-solrj

protected void initWrite(OutputStream os) throws IOException {
 assert !alreadyMarshalled;
 init(FastOutputStream.wrap(os));
 daos.writeByte(VERSION);
}
origin: BroadleafCommerce/BroadleafCommerce

@SuppressWarnings("unchecked")
protected SolrJSONFacet resolveJSONFacet(NamedList facetNamedList) {
  SolrJSONFacet jsonFacet = new SolrJSONFacet();
  Iterator<Map.Entry<String, Object>> iterator = facetNamedList.iterator();
  while (iterator.hasNext()) {
    Map.Entry<String, Object> entry = iterator.next();
    if (entry.getValue() != null) {
      if (NamedList.class.isAssignableFrom(entry.getValue().getClass())) {
        jsonFacet.getMap().put(entry.getKey(), resolveJSONFacet((NamedList) entry.getValue()));
      } else if (List.class.isAssignableFrom(entry.getValue().getClass())) {
        jsonFacet.getMap().put(entry.getKey(), resolveJSONFacetList((List<NamedList>) entry.getValue()));
      } else {
        jsonFacet.getMap().put(entry.getKey(), String.valueOf(entry.getValue()));
      }
    }
  }
  return jsonFacet;
}
origin: org.apache.solr/solr-solrj

public String readStr(DataInputInputStream dis, StringCache stringCache) throws IOException {
 int sz = readSize(dis);
 if (bytes == null || bytes.length < sz) bytes = new byte[sz];
 dis.readFully(bytes, 0, sz);
 if (stringCache != null) {
  return stringCache.get(bytesRef.reset(bytes, 0, sz));
 } else {
  arr.reset();
  ByteUtils.UTF8toUTF16(bytes, 0, sz, arr);
  return arr.toString();
 }
}
origin: tjake/Solandra

public synchronized SolrCore readSchema(String indexName) throws IOException, ParserConfigurationException,
    SAXException
{
  SolrCore core = cache.get(indexName);
  if (core == null)
  {
    // get from cassandra
    if (logger.isDebugEnabled())
      logger.debug("loading index schema for: " + indexName);
    
    ByteBuffer buf = readCoreResource(indexName, CassandraUtils.schemaKey);
    
    //Schema resource not found for the core
    if (buf == null)
    {
      throw new IOException(String.format("invalid core '%s'", indexName));
    }
    
    InputStream stream = new ByteArrayInputStream(ByteBufferUtil.getArray(buf));
    SolrResourceLoader resourceLoader = new SolandraResourceLoader(indexName, null);
    SolrConfig solrConfig = new SolrConfig(resourceLoader, solrConfigFile, null);
    IndexSchema schema = new IndexSchema(solrConfig, indexName, new InputSource(stream));
    core = new SolrCore(indexName, "/tmp", solrConfig, schema, null);
    if (logger.isDebugEnabled())
      logger.debug("Loaded core from cassandra: " + indexName);
    cache.put(indexName, core);
  }
  return core;
}
origin: org.apache.solr/solr-solrj

/**
 * Create a cached thread pool using a named thread factory
 */
public static ExecutorService newMDCAwareCachedThreadPool(String name) {
 return newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory(name));
}
origin: org.apache.solr/solr-solrj

public byte[] readByteArray(DataInputInputStream dis) throws IOException {
 byte[] arr = new byte[readVInt(dis)];
 dis.readFully(arr);
 return arr;
}
//use this to ignore the writable interface because , child docs will ignore the fl flag
origin: org.apache.solr/solr-solrj

public Map getMap(String key, Map def) {
 Object o = getMapVal(key);
 if (o == null) return def;
 if (!(o instanceof Map)) {
  addError(StrUtils.formatString("''{0}'' must be a map", key));
  return def;
 } else {
  return (Map) o;
 }
}
origin: org.apache.solr/solr-solrj

@Override
public Object put(String key, Object val) {
 ensureNotClosed();
 return super.put(key, val);
}
origin: org.apache.solr/solr-solrj

@Override
public void clear() {
 ensureNotClosed();
 super.clear();
}
origin: apache/metron

@SuppressWarnings("unchecked")
public List<String> listCollections() throws IOException, SolrServerException {
 NamedList<Object> response = request(getListCollectionsRequest(), null);
 return (List<String>) response.get(SolrConstants.RESPONSE_COLLECTIONS);
}
origin: BroadleafCommerce/BroadleafCommerce

List<String> collectionNames = listResponse.get("collections") == null ? collectionNames = new ArrayList<>() : (List<String>) listResponse.get("collections");
collectionNames = listResponse.get("collections") == null ? collectionNames = new ArrayList<>() : (List<String>) listResponse.get("collections");
origin: apache/metron

/**
 * Build a group response.
 * @param groupRequest The original group request.
 * @param response The search response.
 * @return A group response.
 */
protected GroupResponse buildGroupResponse(
  GroupRequest groupRequest,
  QueryResponse response) {
 String groupNames = groupRequest.getGroups().stream().map(Group::getField).collect(
   Collectors.joining(","));
 List<PivotField> pivotFields = response.getFacetPivot().get(groupNames);
 GroupResponse groupResponse = new GroupResponse();
 groupResponse.setGroupedBy(groupRequest.getGroups().get(0).getField());
 groupResponse.setGroupResults(getGroupResults(groupRequest, 0, pivotFields));
 return groupResponse;
}
org.apache.solr.common.util

Most used classes

  • NamedList
    A simple container class for modeling an ordered list of name/value pairs. Unlike Maps: * Names m
  • SimpleOrderedMap
    SimpleOrderedMap is a NamedList where access by key is more important than maintaining order when it
  • ContentStream
  • StrUtils
  • ContentStreamBase$StringStream
    Construct a ContentStream from a String
  • JavaBinCodec,
  • XML,
  • DateUtil,
  • Base64,
  • ContentStreamBase$FileStream,
  • FastOutputStream,
  • SuppressForbidden,
  • ExecutorUtil,
  • ExecutorUtil$MDCAwareThreadPoolExecutor,
  • FastInputStream,
  • Hash,
  • ObjectReleaseTracker,
  • FastWriter,
  • IOUtils
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now