You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Matthieu Labour <ma...@strateer.com> on 2010/01/22 21:29:20 UTC

CoreContainer / getCore and create ?

Hi

Would it make sense to modify/ add a method to CoreContainer that creates a
core if the core doesn't exist ?

something like

public SolrCore getCore(String name) {
    synchronized(cores) {
      SolrCore core = cores.get(name);
      if (core != null)
        core.open();  // increment the ref count while still synchronized
      else {
      core = create(name);
      cores.put(name,core);
    }
      return core;
    }
  }


My apology if this already documented...

matt

Re: CoreContainer / getCore and create ?

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
it is not supported now.
If it does it should be a new method say getOrCreateCore(). The
problem is creating a core usually requires extra parameters( like
instanceDir)

On Sat, Jan 23, 2010 at 1:59 AM, Matthieu Labour <ma...@strateer.com> wrote:
> Hi
>
> Would it make sense to modify/ add a method to CoreContainer that creates a
> core if the core doesn't exist ?
>
> something like
>
> public SolrCore getCore(String name) {
>    synchronized(cores) {
>      SolrCore core = cores.get(name);
>      if (core != null)
>        core.open();  // increment the ref count while still synchronized
>      else {
>      core = create(name);
>      cores.put(name,core);
>    }
>      return core;
>    }
>  }
>
>
> My apology if this already documented...
>
> matt
>



-- 
-----------------------------------------------------
Noble Paul | Systems Architect| AOL | http://aol.com