Yonik Seeley wrote:
> 
> On 7/11/07, Will Johnson <[EMAIL PROTECTED]> wrote:
>> I think it would be nice to have the core name
>> specified as a CGI param instead of (or in addition to) a url path.
>> Otherwise, large section of client code (such as solrj/solr#) will need
>> to be changed.
> 
> Only if you want to talk to multiple cores over a single "connection",
> right?
> Hopefully existing client code will allow the specification of the URL,
> and
> one would use http://localhost:8983/solr/core1/
> 
> Still might be useful as a param *if* it can be done efficiently.
> I wonder about the case when the param comes in via POST though.
> 
> -Yonik
> 
> 

Passing the core name as an Http request parameter to use an existing core
is easy.
In the patched SolrServlet, replacing the first few lines of doGet with the
code that follows should do the trick. 
-----------------
  
  private SolrCore getParameterCore(HttpServletRequest request) {
    SolrCore core = null;
    String[] score = request.getParameterValues("core");
    if (score == null)
      return null;
    // lets try till we find one valid core
    for(int c = 0; c < score.length && core == null; ++c)
      core = SolrCore.getSolrCore(score[c]);
    return core;
  }
  
  public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
    SolrCore core = getParameterCore(request);
    if (core == null) {
      if (this.core == null) {
        Object ocore = request.getAttribute("org.apache.solr.SolrCore");
        if (ocore instanceof SolrCore)
          core = (SolrCore) core;
        else
          sendErr(404, "no core to serve request", request, response);
      }
      else
        core = this.core;
    }
...
-------------------

Creating a core dynamically needs a bit more work since we then need to pass
the config & schema to use; suggested ways were naming convention or/and
even potentially upload them.
Hope this helps.
- Henri

-- 
View this message in context: 
http://www.nabble.com/Re%3A--jira--Commented%3A-%28SOLR-2-1-5%29-Multiple-Solr-Cores-tf4063316.html#a11545863
Sent from the Solr - Dev mailing list archive at Nabble.com.

Reply via email to