Im using solrj.
First, create the kernels. I found 2 ways.
first way:
SolrCore solrCore = coreContainer.create(new CoreDescriptor( coreContainer, coreName, ".")); coreContainer.register(solrCore, true);
second way:
SolrQuery solrQuery = new SolrQuery(); solrQuery.setParam(CommonParams.QT, "/admin/cores"); solrQuery.setParam( CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.CREATE.name()); solrQuery.setParam( CoreAdminParams.NAME, name); solrQuery.setParam( CoreAdminParams.INSTANCE_DIR, "./" + name); solrQuery.setParam( CoreAdminParams.CONFIG, solrHomeRelativePath + solrConfigHomeRelativePath); solrQuery.setParam( CoreAdminParams.SCHEMA, solrHomeRelativePath + solrSchemaHomeRelativePath); solrQuery.setParam( CoreAdminParams.DATA_DIR, "."); solrServer.query(solrQuery);
to request a specific kernel, which I just do:
SolrServer solrServer = new EmbeddedSolrServer(coreContainer, coreName);
and then fulfill my queries the way I usually do using solrj.
So, in your case, you just get the name associated with the user performing the search request. The coreContainer instance will be a common, but not an instance of SolrServer.
By the way, I'm doing something like you!
See you later.
source share