RequestParams params = new RequestParams(); params.put("notes", "Test api support"); client.post(restApiUrl, params, responseHandler);
public SolandraCoreContainer(String solrConfigFile) throws ParserConfigurationException, IOException, SAXException { this.solrConfigFile = solrConfigFile; SolrConfig solrConfig = new SolrConfig(solrConfigFile); CoreDescriptor dcore = new CoreDescriptor(null, "", "."); singleCore = new SolrCore("", "/tmp", solrConfig, null, dcore); }
public void init(NamedList args){ super.init(args); indexName = "example"; }
/** Gets a core that does not have its refcount incremented (i.e. there is no need to * close when done). This is not MT safe in conjunction with reloads! */ public SolrCore getCore() { // get the core & decrease its refcount: // the container holds the core for the harness lifetime SolrCore core = container.getCore(coreName); if (core != null) core.close(); return core; }
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; }
@Override public Collection<String> getCoreNames(SolrCore core) { return Arrays.asList(core.getName()); }
@Override public InputStream openResource(String resourceName) { ByteBuffer resourceValue = null; try { resourceValue = SolandraCoreContainer.readCoreResource(coreName, resourceName); } catch (Exception e) { throw new RuntimeException("Error opening " + resourceName, e); } //fallback to solr.home if (resourceValue == null) { return super.openResource(resourceName); } else { return new ByteArrayInputStream(ByteBufferUtil.getArray(resourceValue)); } } }
SchemaField uniqueField = core.getSchema().getUniqueKeyField();
/** Creates a searcher searching the index in the named directory. * * @deprecated use alternate constructor */ public SolrIndexSearcher(SolrCore core, IndexSchema schema, String name, String path, boolean enableCache) throws IOException { this(core, schema,name, core.getIndexReaderFactory().newReader(core.getDirectoryFactory().open(path), false), true, enableCache); }
SolandraCoreInfo indexInfo = new SolandraCoreInfo(name); core = readSchema(indexInfo.coreName); core.open();
resource = SolandraCoreContainer.getCoreMetaInfo(indexName); response.setContentType("text/xml"); resource = ByteBufferUtil.string(SolandraCoreContainer.readCoreResource(indexName, resourceName)); SolandraCoreContainer.writeSchema(indexName, resource); SolandraCoreContainer.writeCoreResource(indexName, resourceName, resource);
SolrHighlighter highligher = rb.req.getCore().getHighlighter(); if (highligher.isHighlightingEnabled(rb.req.getParams()))
protected UpdateHandlerInfo loadUpdatehandlerInfo() { return new UpdateHandlerInfo(get("updateHandler/@class",null), getInt("updateHandler/autoCommit/maxDocs",-1), getInt("updateHandler/autoCommit/maxTime",-1), getInt("updateHandler/commitIntervalLowerBound",-1)); }
public static String getCoreMetaInfo(String indexName) throws IOException SolandraCoreInfo info = new SolandraCoreInfo(indexName); String schemaXML = readSchemaXML(info.coreName); long maxId = IndexManagerService.instance.getMaxId(indexName); int numShards = CassandraIndexManager.getShardFromDocId(maxId);
public String getVersion() { return core.getVersion(); }
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); }
public static String readSchemaXML(String indexName) throws IOException { ByteBuffer schema = readCoreResource(indexName, CassandraUtils.schemaKey); //Schema resource not found for the core if (schema == null) { throw new IOException(String.format("invalid core '%s'", indexName)); } return ByteBufferUtil.string(schema); }
@Override public CoreContainer initialize() throws IOException, ParserConfigurationException, SAXException { CoreContainer cores = new SolandraCoreContainer(solrConfigFilename == null ? SolrConfig.DEFAULT_CONF_FILE : solrConfigFilename); //Startup cassandra if(System.getProperty("solandra.clientmode", "false").equalsIgnoreCase("true")) CassandraUtils.startupClient(); else CassandraUtils.startupServer(); return cores; } }
RequestParams rp = new RequestParams(); rp.add("username", "aaa"); rp.add("password", "aaa@123"); HttpUtils.post(AppConstant.URL_FEED, rp, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { // If the response is JSONObject instead of expected JSONArray Log.d("asd", "---------------- this is response : " + response); try { JSONObject serverResp = new JSONObject(response.toString()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onSuccess(int statusCode, Header[] headers, JSONArray timeline) { // Pull out the first event on the public timeline } }); }