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 Grant Ingersoll <gs...@apache.org> on 2008/08/15 02:56:00 UTC

Re: svn commit: r685577 - in /lucene/solr/trunk: client/java/solrj/src/org/apache/solr/client/solrj/embedded/ client/java/solrj/test/org/apache/solr/client/solrj/ client/java/solrj/test/org/apache/solr/client/solrj/embedded/ example/solr/conf/ src/java/org...

Hey Ryan,

Something's messed up with this commit in regards to the  
SolrDispatchFilter.  It appears the pathPrefix is no longer being  
set.  It gets set on the CoreContainer.Initializer(), but then the  
code later checks to see if the SolrDispatchFilter.pathPrefix is set  
and the path prefix on the init is ignored (not that it could use it,  
since it is out of scope anyway).

Not sure how you want to handle setting the pathPrefix in the SDF.   
It's easy enough to do, just not sure on the relation between the  
Initializer and the member variables in SDF.

-Grant

On Aug 13, 2008, at 10:57 AM, ryan@apache.org wrote:

> Author: ryan
> Date: Wed Aug 13 07:57:20 2008
> New Revision: 685577
>
> URL: http://svn.apache.org/viewvc?rev=685577&view=rev
> Log:
> SOLR-695 -- refactoring MultiCore to CoreContainer
>
> Added:
>    lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java
>      - copied, changed from r685549, lucene/solr/trunk/src/java/org/ 
> apache/solr/core/MultiCore.java
>    lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
> CoreAdminHandler.java
>      - copied, changed from r685549, lucene/solr/trunk/src/java/org/ 
> apache/solr/handler/admin/MultiCoreHandler.java
> Removed:
>    lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java
>    lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
> MultiCoreHandler.java
> Modified:
>    lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
> solrj/embedded/EmbeddedSolrServer.java
>    lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
> solrj/MultiCoreExampleTestBase.java
>    lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
> solrj/embedded/JettyWebappTest.java
>    lucene/solr/trunk/example/solr/conf/schema.xml
>    lucene/solr/trunk/src/java/org/apache/solr/core/CoreDescriptor.java
>    lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
>    lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
> SolrDispatchFilter.java
>    lucene/solr/trunk/src/webapp/web/admin/index.jsp
>    lucene/solr/trunk/src/webapp/web/index.jsp
>
> Modified: lucene/solr/trunk/client/java/solrj/src/org/apache/solr/ 
> client/solrj/embedded/EmbeddedSolrServer.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
> solrj/embedded/EmbeddedSolrServer.java (original)
> +++ lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
> solrj/embedded/EmbeddedSolrServer.java Wed Aug 13 07:57:20 2008
> @@ -34,7 +34,7 @@
> import org.apache.solr.common.params.ModifiableSolrParams;
> import org.apache.solr.common.params.SolrParams;
> import org.apache.solr.common.util.NamedList;
> -import org.apache.solr.core.MultiCore;
> +import org.apache.solr.core.CoreContainer;
> import org.apache.solr.core.SolrCore;
> import org.apache.solr.request.BinaryResponseWriter;
> import org.apache.solr.request.QueryResponseWriter;
> @@ -55,9 +55,9 @@
> public class EmbeddedSolrServer extends SolrServer
> {
>
> -  protected final MultiCore multicore; // either multicore
> +  protected final CoreContainer multicore; // either multicore
>   protected final SolrCore core; // or single core
> -  protected final String coreName;  // use MultiCore registry
> +  protected final String coreName;  // use CoreContainer registry
>
>   private final SolrRequestParsers _parser;
>
> @@ -73,10 +73,10 @@
>     _parser = new SolrRequestParsers( null );
>   }
>
> -  public EmbeddedSolrServer(  MultiCore multicore, String coreName )
> +  public EmbeddedSolrServer(  CoreContainer multicore, String  
> coreName )
>   {
>     if ( multicore == null ) {
> -      throw new NullPointerException("MultiCore instance required");
> +      throw new NullPointerException("CoreContainer instance  
> required");
>     }
>     this.core = null;
>     this.multicore = multicore;
>
> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
> client/solrj/MultiCoreExampleTestBase.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
> solrj/MultiCoreExampleTestBase.java (original)
> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
> solrj/MultiCoreExampleTestBase.java Wed Aug 13 07:57:20 2008
> @@ -25,7 +25,7 @@
> import org.apache.solr.client.solrj.request.UpdateRequest.ACTION;
> import org.apache.solr.client.solrj.response.MultiCoreResponse;
> import org.apache.solr.common.SolrInputDocument;
> -import org.apache.solr.core.MultiCore;
> +import org.apache.solr.core.CoreContainer;
>
>
> /**
> @@ -34,7 +34,7 @@
>  */
> public abstract class MultiCoreExampleTestBase extends  
> SolrExampleTestBase
> {
> -  protected static final MultiCore multicore = new MultiCore();
> +  protected static final CoreContainer multicore = new  
> CoreContainer();
>
>   @Override public String getSolrHome() { return "../../../example/ 
> multicore/"; }
>
>
> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
> client/solrj/embedded/JettyWebappTest.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
> solrj/embedded/JettyWebappTest.java (original)
> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
> solrj/embedded/JettyWebappTest.java Wed Aug 13 07:57:20 2008
> @@ -76,6 +76,7 @@
>     assertNotNull( html ); // real error will be an exception
>
>     adminPath += "admin/";
> +    html = IOUtils.toString( new URL(adminPath).openStream() );
>     assertNotNull( html ); // real error will be an exception
>
>     // analysis
>
> Modified: lucene/solr/trunk/example/solr/conf/schema.xml
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/example/solr/conf/schema.xml (original)
> +++ lucene/solr/trunk/example/solr/conf/schema.xml Wed Aug 13  
> 07:57:20 2008
> @@ -204,6 +204,14 @@
>       </analyzer>
>     </fieldType>
>
> +    <fieldType name="grams" class="solr.TextField"  
> positionIncrementGap="100" >
> +      <analyzer>
> +        <tokenizer class="solr.StandardTokenizerFactory"/>
> +        <filter class="solr.WordDelimiterFilterFactory"  
> generateWordParts="1" generateNumberParts="1" catenateWords="0"  
> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
> +        <filter class="solr.LengthFilterFactory" min="3" max="15" />
> +        <filter class="solr.WordGramFilterFactory" minLength="1"  
> maxLength="3" sep=" " />
> +      </analyzer>
> +    </fieldType>
>
>     <!--
>      Setup simple analysis for spell checking
>
> Copied: lucene/solr/trunk/src/java/org/apache/solr/core/ 
> CoreContainer.java (from r685549, lucene/solr/trunk/src/java/org/ 
> apache/solr/core/MultiCore.java)
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java?p2=lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java&p1=lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java&r1=685549&r2=685577&rev=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java  
> (original)
> +++ lucene/solr/trunk/src/java/org/apache/solr/core/ 
> CoreContainer.java Wed Aug 13 07:57:20 2008
> @@ -36,7 +36,7 @@
> import org.apache.solr.common.SolrException;
> import org.apache.solr.common.util.DOMUtil;
> import org.apache.solr.common.util.XML;
> -import org.apache.solr.handler.admin.MultiCoreHandler;
> +import org.apache.solr.handler.admin.CoreAdminHandler;
> import org.apache.solr.schema.IndexSchema;
> import org.w3c.dom.Node;
> import org.w3c.dom.NodeList;
> @@ -47,27 +47,27 @@
>  * @version $Id$
>  * @since solr 1.3
>  */
> -public class MultiCore
> +public class CoreContainer
> {
> -  protected static Logger log =  
> Logger.getLogger(MultiCore.class.getName());
> +  protected static Logger log =  
> Logger.getLogger(CoreContainer.class.getName());
>
>   protected final Map<String, CoreDescriptor> cores = new  
> LinkedHashMap<String, CoreDescriptor>();
>   protected boolean enabled = false;
>   protected boolean persistent = false;
>   protected String adminPath = null;
> -  protected MultiCoreHandler multiCoreHandler = null;
> +  protected CoreAdminHandler coreAdminHandler = null;
>   protected File configFile = null;
>   protected String libDir = null;
>   protected ClassLoader libLoader = null;
>   protected SolrResourceLoader loader = null;
>   protected java.lang.ref.WeakReference<SolrCore> adminCore = null;
>
> -  public MultiCore() {
> +  public CoreContainer() {
>
>   }
>
>   /**
> -   * Initalize MultiCore directly from the constructor
> +   * Initalize CoreContainer directly from the constructor
>    *
>    * @param dir
>    * @param configFile
> @@ -75,7 +75,7 @@
>    * @throws IOException
>    * @throws SAXException
>    */
> -  public MultiCore(String dir, File configFile ) throws  
> ParserConfigurationException, IOException, SAXException
> +  public CoreContainer(String dir, File configFile ) throws  
> ParserConfigurationException, IOException, SAXException
>   {
>     this.load(dir, configFile);
>   }
> @@ -113,7 +113,7 @@
>       }
>
>       if( adminPath != null ) {
> -        multiCoreHandler = this.createMultiCoreHandler();
> +        coreAdminHandler = this.createMultiCoreHandler();
>       }
>
>       NodeList nodes = (NodeList)cfg.evaluate("solr/cores/core",  
> XPathConstants.NODESET);
> @@ -357,9 +357,9 @@
>   }
>
>   /**
> -   * Sets the preferred core used to handle MultiCore admin tasks.
> +   * Sets the preferred core used to handle CoreContainer admin  
> tasks.
>    * Note that getAdminCore is not symmetrical to this method since
> -   * it will allways return an opened SolrCore.
> +   * it will always return an opened SolrCore.
>    * This however can be useful implementing a "metacore" (a core of  
> cores).
>    */
>   public void setAdminCore(SolrCore core) {
> @@ -369,8 +369,8 @@
>   }
>
>   /**
> -   * Gets a core to handle MultiCore admin tasks (@see  
> SolrDispatchFilter).
> -   * This makes the best attempt to reuse the same opened SolrCore  
> accross calls.
> +   * Gets a core to handle CoreContainer admin tasks (@see  
> SolrDispatchFilter).
> +   * This makes the best attempt to reuse the same opened SolrCore  
> across calls.
>    */
>   public SolrCore getAdminCore() {
>     synchronized (cores) {
> @@ -391,20 +391,20 @@
>   }
>
>   /**
> -   * Creates a MultiCoreHandler for this MultiCore.
> -   * @return a MultiCoreHandler
> +   * Creates a CoreAdminHandler for this CoreContainer.
> +   * @return a CoreAdminHandler
>    */
> -  protected MultiCoreHandler createMultiCoreHandler() {
> -    return new MultiCoreHandler() {
> +  protected CoreAdminHandler createMultiCoreHandler() {
> +    return new CoreAdminHandler() {
>       @Override
> -      public MultiCore getMultiCore() {
> -        return MultiCore.this;
> +      public CoreContainer getMultiCore() {
> +        return CoreContainer.this;
>       }
>     };
>   }
>
> -  public MultiCoreHandler getMultiCoreHandler() {
> -    return multiCoreHandler;
> +  public CoreAdminHandler getMultiCoreHandler() {
> +    return coreAdminHandler;
>   }
>
>   public File getConfigFile() {
>
> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/ 
> CoreDescriptor.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreDescriptor.java?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/java/org/apache/solr/core/ 
> CoreDescriptor.java (original)
> +++ lucene/solr/trunk/src/java/org/apache/solr/core/ 
> CoreDescriptor.java Wed Aug 13 07:57:20 2008
> @@ -17,13 +17,10 @@
>
> package org.apache.solr.core;
>
> -import org.xml.sax.SAXException;
> -
> -import javax.xml.parsers.ParserConfigurationException;
> -import java.io.IOException;
>
> /**
>  * A Solr core descriptor
> + *
>  * @since solr 1.3
>  */
> public class CoreDescriptor implements Cloneable {
> @@ -32,10 +29,10 @@
>   protected String configName;
>   protected String schemaName;
>   protected SolrCore core = null;
> -  private final MultiCore multiCore;
> +  private final CoreContainer coreContainer;
>
> -  public CoreDescriptor(MultiCore multiCore) {
> -    this.multiCore = multiCore;
> +  public CoreDescriptor(CoreContainer coreContainer) {
> +    this.coreContainer = coreContainer;
>   }
>
>   /** Initialize defaults from instance directory. */
> @@ -58,7 +55,7 @@
>     this.instanceDir = descr.instanceDir;
>     this.configName = descr.configName;
>     this.schemaName = descr.schemaName;
> -    multiCore = descr.multiCore;
> +    coreContainer = descr.coreContainer;
>   }
>
>   /**@return the default config name. */
> @@ -123,7 +120,7 @@
>     this.core = core;
>   }
>
> -  public MultiCore getMultiCore() {
> -    return multiCore;
> +  public CoreContainer getMultiCore() {
> +    return coreContainer;
>   }
> }
>
> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/ 
> SolrCore.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java  
> (original)
> +++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java  
> Wed Aug 13 07:57:20 2008
> @@ -91,7 +91,7 @@
>   public long getStartTime() { return startTime; }
>
>   /**
> -   * @deprecated Use {@link MultiCore#getCore(String)} instead.
> +   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
>    */
>   @Deprecated
>   private static SolrCore instance;
> @@ -345,7 +345,7 @@
>    * @return the last core initialized.  If you are using multiple  
> cores,
>    * this is not a function to use.
>    *
> -   * @deprecated Use {@link MultiCore#getCore(String)} instead.
> +   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
>    */
>   @Deprecated
>   public static SolrCore getSolrCore() {
>
> Copied: lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
> CoreAdminHandler.java (from r685549, lucene/solr/trunk/src/java/org/ 
> apache/solr/handler/admin/MultiCoreHandler.java)
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?p2=lucene/solr/trunk/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java&p1=lucene/solr/trunk/src/java/org/apache/solr/handler/admin/MultiCoreHandler.java&r1=685549&r2=685577&rev=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
> MultiCoreHandler.java (original)
> +++ lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
> CoreAdminHandler.java Wed Aug 13 07:57:20 2008
> @@ -26,7 +26,7 @@
> import org.apache.solr.common.params.MultiCoreParams.MultiCoreAction;
> import org.apache.solr.common.util.NamedList;
> import org.apache.solr.common.util.SimpleOrderedMap;
> -import org.apache.solr.core.MultiCore;
> +import org.apache.solr.core.CoreContainer;
> import org.apache.solr.core.SolrCore;
> import org.apache.solr.core.CoreDescriptor;
> import org.apache.solr.handler.RequestHandlerBase;
> @@ -39,12 +39,12 @@
>  * @version $Id$
>  * @since solr 1.3
>  */
> -public abstract class MultiCoreHandler extends RequestHandlerBase
> +public abstract class CoreAdminHandler extends RequestHandlerBase
> {
> -  public MultiCoreHandler()
> +  public CoreAdminHandler()
>   {
>     super();
> -    // Unlike most request handlers, MultiCore initialization
> +    // Unlike most request handlers, CoreContainer initialization
>     // should happen in the constructor...
>   }
>
> @@ -52,25 +52,25 @@
>   @Override
>   final public void init(NamedList args) {
>     throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
> -        "MultiCoreHandler should not be configured in solrconf.xml 
> \n"+
> +        "CoreAdminHandler should not be configured in solrconf.xml 
> \n"+
>         "it is a special Handler configured directly by the  
> RequestDispatcher" );
>   }
>
>   /**
>    * The instance of multicore this handler handles.
> -   * This should be the MultiCore instance that created this handler.
> -   * @return a MultiCore instance
> +   * This should be the CoreContainer instance that created this  
> handler.
> +   * @return a CoreContainer instance
>    */
> -  public abstract MultiCore getMultiCore();
> +  public abstract CoreContainer getMultiCore();
>
>   @Override
>   public void handleRequestBody(SolrQueryRequest req,  
> SolrQueryResponse rsp) throws Exception
>   {
>     // Make sure the manager is enabled
> -    MultiCore manager = getMultiCore();
> +    CoreContainer manager = getMultiCore();
>     if( !manager.isEnabled() ) {
>       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
> -          "MultiCore support must be enabled at startup." );
> +          "CoreContainer support must be enabled at startup." );
>     }
>     boolean do_persist = false;
>
>
> Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
> SolrDispatchFilter.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
> SolrDispatchFilter.java (original)
> +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
> SolrDispatchFilter.java Wed Aug 13 07:57:20 2008
> @@ -52,7 +52,7 @@
>
>   protected CoreDescriptor singleCoreDescriptor;
>
> -  protected MultiCore multicore;
> +  protected CoreContainer cores;
>   protected String pathPrefix = null; // strip this from the  
> beginning of a path
>   protected String abortErrorMessage = null;
>   protected final WeakHashMap<SolrCore, SolrRequestParsers> parsers  
> = new WeakHashMap<SolrCore, SolrRequestParsers>();
> @@ -68,14 +68,14 @@
>       this.pathPrefix = config.getInitParameter( "path-prefix" );
>       this.solrConfigFilename = config.getInitParameter("solrconfig- 
> filename");
>
> -      // multicore instantiation
> -      this.multicore = initMultiCore(config);
> +      // cores instantiation
> +      this.cores = initMultiCore(config);
>
> -      if(multicore != null && multicore.isEnabled() ) {
> +      if(cores != null && cores.isEnabled() ) {
>         abortOnConfigurationError = false;
>         singleCoreDescriptor = null;
>         // if any core aborts on startup, then abort
> -        for( SolrCore c : multicore.getCores() ) {
> +        for( SolrCore c : cores.getCores() ) {
>            
> if( c.getSolrConfig().getBool( "abortOnConfigurationError",false) ) {
>             abortOnConfigurationError = true;
>             break;
> @@ -84,7 +84,7 @@
>       }
>       else {
>         SolrConfig cfg = this.solrConfigFilename == null? new  
> SolrConfig() : new SolrConfig(this.solrConfigFilename);
> -        singleCoreDescriptor = new CoreDescriptor((MultiCore)null);
> +        singleCoreDescriptor = new  
> CoreDescriptor((CoreContainer)null);
>          
> singleCoreDescriptor 
> .init("",cfg.getResourceLoader().getInstanceDir());
>         SolrCore singlecore = new SolrCore( null, null, cfg, null,  
> singleCoreDescriptor);
>         singleCoreDescriptor.setCore(singlecore);
> @@ -108,7 +108,7 @@
>       out.println( "Check your log files for more detailed  
> information on what may be wrong.\n" );
>       out.println( "If you want solr to continue after configuration  
> errors, change: \n");
>       out.println( " <abortOnConfigurationError>false</ 
> abortOnConfigurationError>\n" );
> -      if (multicore != null && multicore.isEnabled()) {
> +      if (cores != null && cores.isEnabled()) {
>         out.println( "in solr.xml\n" );
>       } else {
>         out.println( "in solrconfig.xml\n" );
> @@ -133,13 +133,13 @@
>   }
>
>   /**
> -   * Initialize the multicore instance.
> +   * Initialize the cores instance.
>    * @param config the filter configuration
> -   * @return the multicore instance or null
> +   * @return the cores instance or null
>    * @throws java.lang.Exception
>    */
> -  protected MultiCore initMultiCore(FilterConfig config) throws  
> Exception {
> -    MultiCore mcore = new MultiCore();
> +  protected CoreContainer initMultiCore(FilterConfig config) throws  
> Exception {
> +    CoreContainer mcore = new CoreContainer();
>     String instanceDir = SolrResourceLoader.locateInstanceDir();
>     File fconf = new File(instanceDir, "solr.xml");
>     log.info("looking for solr.xml: " + fconf.getAbsolutePath());
> @@ -151,9 +151,9 @@
>
>
>   public void destroy() {
> -    if (multicore != null) {
> -    multicore.shutdown();
> -      multicore = null;
> +    if (cores != null) {
> +    cores.shutdown();
> +      cores = null;
>     }
>     if( singleCoreDescriptor != null ) {
>       singleCoreDescriptor.getCore().close();
> @@ -189,18 +189,18 @@
>           path = path.substring( 0, idx );
>         }
>
> -        // By default use the single core.  If multicore is  
> enabled, look for one.
> +        // By default use the single core.  If cores is enabled,  
> look for one.
>         final SolrCore core;
> -        if (multicore != null && multicore.isEnabled()) {
> -          req.setAttribute("org.apache.solr.MultiCore", multicore);
> +        if (cores != null && cores.isEnabled()) {
> +          req.setAttribute("org.apache.solr.CoreContainer", cores);
>
>           // if this is the multi-core admin page, it will handle it
> -          if( path.equals( multicore.getAdminPath() ) ) {
> -            handler = multicore.getMultiCoreHandler();
> +          if( path.equals( cores.getAdminPath() ) ) {
> +            handler = cores.getMultiCoreHandler();
>             // pick a core to use for output generation
> -            core = multicore.getAdminCore();
> +            core = cores.getAdminCore();
>             if( core == null ) {
> -              throw new RuntimeException( "Can not find a valid  
> core for the multicore admin handler" );
> +              throw new RuntimeException( "Can not find a valid  
> core for the cores admin handler" );
>             }
>           } else {
>             //otherwise, we should find a core from the path
> @@ -209,7 +209,7 @@
>               // try to get the corename as a request parameter first
>               String corename = path.substring( 1, idx );
>               path = path.substring( idx );
> -              core = multicore.getCore( corename );
> +              core = cores.getCore( corename );
>             } else {
>               core = null;
>             }
> @@ -231,7 +231,7 @@
>           }
>
>           // Determine the handler from the url path if not set
> -          // (we might already have selected the multicore handler)
> +          // (we might already have selected the cores handler)
>           if( handler == null && path.length() > 1 ) { // don't  
> match "" or "/" as valid path
>             handler = core.getRequestHandler( path );
>             // no handler yet but allowed to handle select; let's  
> check
>
> Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/index.jsp?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original)
> +++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Wed Aug 13  
> 07:57:20 2008
> @@ -52,7 +52,7 @@
> </tr>
>
> <%-- List the cores (that arent this one) so we can switch --%>
> -<% org.apache.solr.core.MultiCore multicore =  
> (org 
> .apache 
> .solr 
> .core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
> +<% org.apache.solr.core.CoreContainer multicore =  
> (org 
> .apache 
> .solr 
> .core 
> .CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
>   if (multicore!=null) {
>   java.util.Collection<SolrCore> cores = multicore.getCores();
> if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></ 
> td><td><%
>
> Modified: lucene/solr/trunk/src/webapp/web/index.jsp
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/index.jsp?rev=685577&r1=685576&r2=685577&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- lucene/solr/trunk/src/webapp/web/index.jsp (original)
> +++ lucene/solr/trunk/src/webapp/web/index.jsp Wed Aug 13 07:57:20  
> 2008
> @@ -28,7 +28,7 @@
> <a href="."><img border="0" align="right" height="61" width="142"  
> src="admin/solr-head.gif" alt="Solr"/></a>
>
> <%
> -  org.apache.solr.core.MultiCore multicore =  
> (org 
> .apache 
> .solr 
> .core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
> +  org.apache.solr.core.CoreContainer multicore =  
> (org 
> .apache 
> .solr 
> .core 
> .CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
>   if(multicore != null && multicore.isEnabled() ) {
>     for( org.apache.solr.core.SolrCore core : multicore.getCores() )  
> {%>
> <a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %></ 
> a><br/>
>
>

--------------------------
Grant Ingersoll
http://www.lucidimagination.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ








Re: svn commit: r685577 - in /lucene/solr/trunk: client/java/solrj/src/org/apache/solr/client/solrj/embedded/ client/java/solrj/test/org/apache/solr/client/solrj/ client/java/solrj/test/org/apache/solr/client/solrj/embedded/ example/solr/conf/ src/java/org...

Posted by Ryan McKinley <ry...@gmail.com>.
thanks grant -- just committed a slightly different one :)


On Aug 14, 2008, at 9:06 PM, Grant Ingersoll wrote:

> Here's a _possible_ patch:
>
> Index: src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
> ===================================================================
> --- src/webapp/src/org/apache/solr/servlet/ 
> SolrDispatchFilter.java      (revision 686097)
> +++ src/webapp/src/org/apache/solr/servlet/ 
> SolrDispatchFilter.java      (working copy)
> @@ -64,7 +64,9 @@
>     try {
>       // web.xml configuration
>       init.setPathPrefix(config.getInitParameter( "path-prefix" ));
> +      this.pathPrefix = init.getPathPrefix();
>       init.setSolrConfigFilename(config.getInitParameter("solrconfig- 
> filename"));
> +      this.solrConfigFilename = init.getSolrConfigFilename();
>
>       this.cores = init.initialize();
>       abortOnConfigurationError = init.isAbortOnConfigurationError();
>
>
> -Grant
>
>
> On Aug 14, 2008, at 8:56 PM, Grant Ingersoll wrote:
>
>> Hey Ryan,
>>
>> Something's messed up with this commit in regards to the  
>> SolrDispatchFilter.  It appears the pathPrefix is no longer being  
>> set.  It gets set on the CoreContainer.Initializer(), but then the  
>> code later checks to see if the SolrDispatchFilter.pathPrefix is  
>> set and the path prefix on the init is ignored (not that it could  
>> use it, since it is out of scope anyway).
>>
>> Not sure how you want to handle setting the pathPrefix in the SDF.   
>> It's easy enough to do, just not sure on the relation between the  
>> Initializer and the member variables in SDF.
>>
>> -Grant
>>
>> On Aug 13, 2008, at 10:57 AM, ryan@apache.org wrote:
>>
>>> Author: ryan
>>> Date: Wed Aug 13 07:57:20 2008
>>> New Revision: 685577
>>>
>>> URL: http://svn.apache.org/viewvc?rev=685577&view=rev
>>> Log:
>>> SOLR-695 -- refactoring MultiCore to CoreContainer
>>>
>>> Added:
>>>  lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java
>>>    - copied, changed from r685549, lucene/solr/trunk/src/java/org/ 
>>> apache/solr/core/MultiCore.java
>>>  lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>>> CoreAdminHandler.java
>>>    - copied, changed from r685549, lucene/solr/trunk/src/java/org/ 
>>> apache/solr/handler/admin/MultiCoreHandler.java
>>> Removed:
>>>  lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java
>>>  lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>>> MultiCoreHandler.java
>>> Modified:
>>>  lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
>>> solrj/embedded/EmbeddedSolrServer.java
>>>  lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>>> solrj/MultiCoreExampleTestBase.java
>>>  lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>>> solrj/embedded/JettyWebappTest.java
>>>  lucene/solr/trunk/example/solr/conf/schema.xml
>>>  lucene/solr/trunk/src/java/org/apache/solr/core/CoreDescriptor.java
>>>  lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
>>>  lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>>> SolrDispatchFilter.java
>>>  lucene/solr/trunk/src/webapp/web/admin/index.jsp
>>>  lucene/solr/trunk/src/webapp/web/index.jsp
>>>
>>> Modified: lucene/solr/trunk/client/java/solrj/src/org/apache/solr/ 
>>> client/solrj/embedded/EmbeddedSolrServer.java
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
>>> solrj/embedded/EmbeddedSolrServer.java (original)
>>> +++ lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
>>> solrj/embedded/EmbeddedSolrServer.java Wed Aug 13 07:57:20 2008
>>> @@ -34,7 +34,7 @@
>>> import org.apache.solr.common.params.ModifiableSolrParams;
>>> import org.apache.solr.common.params.SolrParams;
>>> import org.apache.solr.common.util.NamedList;
>>> -import org.apache.solr.core.MultiCore;
>>> +import org.apache.solr.core.CoreContainer;
>>> import org.apache.solr.core.SolrCore;
>>> import org.apache.solr.request.BinaryResponseWriter;
>>> import org.apache.solr.request.QueryResponseWriter;
>>> @@ -55,9 +55,9 @@
>>> public class EmbeddedSolrServer extends SolrServer
>>> {
>>>
>>> -  protected final MultiCore multicore; // either multicore
>>> +  protected final CoreContainer multicore; // either multicore
>>> protected final SolrCore core; // or single core
>>> -  protected final String coreName;  // use MultiCore registry
>>> +  protected final String coreName;  // use CoreContainer registry
>>>
>>> private final SolrRequestParsers _parser;
>>>
>>> @@ -73,10 +73,10 @@
>>>   _parser = new SolrRequestParsers( null );
>>> }
>>>
>>> -  public EmbeddedSolrServer(  MultiCore multicore, String  
>>> coreName )
>>> +  public EmbeddedSolrServer(  CoreContainer multicore, String  
>>> coreName )
>>> {
>>>   if ( multicore == null ) {
>>> -      throw new NullPointerException("MultiCore instance  
>>> required");
>>> +      throw new NullPointerException("CoreContainer instance  
>>> required");
>>>   }
>>>   this.core = null;
>>>   this.multicore = multicore;
>>>
>>> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>>> client/solrj/MultiCoreExampleTestBase.java
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>>> client/solrj/MultiCoreExampleTestBase.java (original)
>>> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>>> client/solrj/MultiCoreExampleTestBase.java Wed Aug 13 07:57:20 2008
>>> @@ -25,7 +25,7 @@
>>> import org.apache.solr.client.solrj.request.UpdateRequest.ACTION;
>>> import org.apache.solr.client.solrj.response.MultiCoreResponse;
>>> import org.apache.solr.common.SolrInputDocument;
>>> -import org.apache.solr.core.MultiCore;
>>> +import org.apache.solr.core.CoreContainer;
>>>
>>>
>>> /**
>>> @@ -34,7 +34,7 @@
>>> */
>>> public abstract class MultiCoreExampleTestBase extends  
>>> SolrExampleTestBase
>>> {
>>> -  protected static final MultiCore multicore = new MultiCore();
>>> +  protected static final CoreContainer multicore = new  
>>> CoreContainer();
>>>
>>> @Override public String getSolrHome() { return "../../../example/ 
>>> multicore/"; }
>>>
>>>
>>> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>>> client/solrj/embedded/JettyWebappTest.java
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>>> client/solrj/embedded/JettyWebappTest.java (original)
>>> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>>> client/solrj/embedded/JettyWebappTest.java Wed Aug 13 07:57:20 2008
>>> @@ -76,6 +76,7 @@
>>>   assertNotNull( html ); // real error will be an exception
>>>
>>>   adminPath += "admin/";
>>> +    html = IOUtils.toString( new URL(adminPath).openStream() );
>>>   assertNotNull( html ); // real error will be an exception
>>>
>>>   // analysis
>>>
>>> Modified: lucene/solr/trunk/example/solr/conf/schema.xml
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/example/solr/conf/schema.xml (original)
>>> +++ lucene/solr/trunk/example/solr/conf/schema.xml Wed Aug 13  
>>> 07:57:20 2008
>>> @@ -204,6 +204,14 @@
>>>     </analyzer>
>>>   </fieldType>
>>>
>>> +    <fieldType name="grams" class="solr.TextField"  
>>> positionIncrementGap="100" >
>>> +      <analyzer>
>>> +        <tokenizer class="solr.StandardTokenizerFactory"/>
>>> +        <filter class="solr.WordDelimiterFilterFactory"  
>>> generateWordParts="1" generateNumberParts="1" catenateWords="0"  
>>> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
>>> +        <filter class="solr.LengthFilterFactory" min="3"  
>>> max="15" />
>>> +        <filter class="solr.WordGramFilterFactory" minLength="1"  
>>> maxLength="3" sep=" " />
>>> +      </analyzer>
>>> +    </fieldType>
>>>
>>>   <!--
>>>    Setup simple analysis for spell checking
>>>
>>> Copied: lucene/solr/trunk/src/java/org/apache/solr/core/ 
>>> CoreContainer.java (from r685549, lucene/solr/trunk/src/java/org/ 
>>> apache/solr/core/MultiCore.java)
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java?p2=lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java&p1=lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java&r1=685549&r2=685577&rev=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java  
>>> (original)
>>> +++ lucene/solr/trunk/src/java/org/apache/solr/core/ 
>>> CoreContainer.java Wed Aug 13 07:57:20 2008
>>> @@ -36,7 +36,7 @@
>>> import org.apache.solr.common.SolrException;
>>> import org.apache.solr.common.util.DOMUtil;
>>> import org.apache.solr.common.util.XML;
>>> -import org.apache.solr.handler.admin.MultiCoreHandler;
>>> +import org.apache.solr.handler.admin.CoreAdminHandler;
>>> import org.apache.solr.schema.IndexSchema;
>>> import org.w3c.dom.Node;
>>> import org.w3c.dom.NodeList;
>>> @@ -47,27 +47,27 @@
>>> * @version $Id$
>>> * @since solr 1.3
>>> */
>>> -public class MultiCore
>>> +public class CoreContainer
>>> {
>>> -  protected static Logger log =  
>>> Logger.getLogger(MultiCore.class.getName());
>>> +  protected static Logger log =  
>>> Logger.getLogger(CoreContainer.class.getName());
>>>
>>> protected final Map<String, CoreDescriptor> cores = new  
>>> LinkedHashMap<String, CoreDescriptor>();
>>> protected boolean enabled = false;
>>> protected boolean persistent = false;
>>> protected String adminPath = null;
>>> -  protected MultiCoreHandler multiCoreHandler = null;
>>> +  protected CoreAdminHandler coreAdminHandler = null;
>>> protected File configFile = null;
>>> protected String libDir = null;
>>> protected ClassLoader libLoader = null;
>>> protected SolrResourceLoader loader = null;
>>> protected java.lang.ref.WeakReference<SolrCore> adminCore = null;
>>>
>>> -  public MultiCore() {
>>> +  public CoreContainer() {
>>>
>>> }
>>>
>>> /**
>>> -   * Initalize MultiCore directly from the constructor
>>> +   * Initalize CoreContainer directly from the constructor
>>>  *
>>>  * @param dir
>>>  * @param configFile
>>> @@ -75,7 +75,7 @@
>>>  * @throws IOException
>>>  * @throws SAXException
>>>  */
>>> -  public MultiCore(String dir, File configFile ) throws  
>>> ParserConfigurationException, IOException, SAXException
>>> +  public CoreContainer(String dir, File configFile ) throws  
>>> ParserConfigurationException, IOException, SAXException
>>> {
>>>   this.load(dir, configFile);
>>> }
>>> @@ -113,7 +113,7 @@
>>>     }
>>>
>>>     if( adminPath != null ) {
>>> -        multiCoreHandler = this.createMultiCoreHandler();
>>> +        coreAdminHandler = this.createMultiCoreHandler();
>>>     }
>>>
>>>     NodeList nodes = (NodeList)cfg.evaluate("solr/cores/core",  
>>> XPathConstants.NODESET);
>>> @@ -357,9 +357,9 @@
>>> }
>>>
>>> /**
>>> -   * Sets the preferred core used to handle MultiCore admin tasks.
>>> +   * Sets the preferred core used to handle CoreContainer admin  
>>> tasks.
>>>  * Note that getAdminCore is not symmetrical to this method since
>>> -   * it will allways return an opened SolrCore.
>>> +   * it will always return an opened SolrCore.
>>>  * This however can be useful implementing a "metacore" (a core of  
>>> cores).
>>>  */
>>> public void setAdminCore(SolrCore core) {
>>> @@ -369,8 +369,8 @@
>>> }
>>>
>>> /**
>>> -   * Gets a core to handle MultiCore admin tasks (@see  
>>> SolrDispatchFilter).
>>> -   * This makes the best attempt to reuse the same opened  
>>> SolrCore accross calls.
>>> +   * Gets a core to handle CoreContainer admin tasks (@see  
>>> SolrDispatchFilter).
>>> +   * This makes the best attempt to reuse the same opened  
>>> SolrCore across calls.
>>>  */
>>> public SolrCore getAdminCore() {
>>>   synchronized (cores) {
>>> @@ -391,20 +391,20 @@
>>> }
>>>
>>> /**
>>> -   * Creates a MultiCoreHandler for this MultiCore.
>>> -   * @return a MultiCoreHandler
>>> +   * Creates a CoreAdminHandler for this CoreContainer.
>>> +   * @return a CoreAdminHandler
>>>  */
>>> -  protected MultiCoreHandler createMultiCoreHandler() {
>>> -    return new MultiCoreHandler() {
>>> +  protected CoreAdminHandler createMultiCoreHandler() {
>>> +    return new CoreAdminHandler() {
>>>     @Override
>>> -      public MultiCore getMultiCore() {
>>> -        return MultiCore.this;
>>> +      public CoreContainer getMultiCore() {
>>> +        return CoreContainer.this;
>>>     }
>>>   };
>>> }
>>>
>>> -  public MultiCoreHandler getMultiCoreHandler() {
>>> -    return multiCoreHandler;
>>> +  public CoreAdminHandler getMultiCoreHandler() {
>>> +    return coreAdminHandler;
>>> }
>>>
>>> public File getConfigFile() {
>>>
>>> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/ 
>>> CoreDescriptor.java
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreDescriptor.java?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/java/org/apache/solr/core/ 
>>> CoreDescriptor.java (original)
>>> +++ lucene/solr/trunk/src/java/org/apache/solr/core/ 
>>> CoreDescriptor.java Wed Aug 13 07:57:20 2008
>>> @@ -17,13 +17,10 @@
>>>
>>> package org.apache.solr.core;
>>>
>>> -import org.xml.sax.SAXException;
>>> -
>>> -import javax.xml.parsers.ParserConfigurationException;
>>> -import java.io.IOException;
>>>
>>> /**
>>> * A Solr core descriptor
>>> + *
>>> * @since solr 1.3
>>> */
>>> public class CoreDescriptor implements Cloneable {
>>> @@ -32,10 +29,10 @@
>>> protected String configName;
>>> protected String schemaName;
>>> protected SolrCore core = null;
>>> -  private final MultiCore multiCore;
>>> +  private final CoreContainer coreContainer;
>>>
>>> -  public CoreDescriptor(MultiCore multiCore) {
>>> -    this.multiCore = multiCore;
>>> +  public CoreDescriptor(CoreContainer coreContainer) {
>>> +    this.coreContainer = coreContainer;
>>> }
>>>
>>> /** Initialize defaults from instance directory. */
>>> @@ -58,7 +55,7 @@
>>>   this.instanceDir = descr.instanceDir;
>>>   this.configName = descr.configName;
>>>   this.schemaName = descr.schemaName;
>>> -    multiCore = descr.multiCore;
>>> +    coreContainer = descr.coreContainer;
>>> }
>>>
>>> /**@return the default config name. */
>>> @@ -123,7 +120,7 @@
>>>   this.core = core;
>>> }
>>>
>>> -  public MultiCore getMultiCore() {
>>> -    return multiCore;
>>> +  public CoreContainer getMultiCore() {
>>> +    return coreContainer;
>>> }
>>> }
>>>
>>> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/ 
>>> SolrCore.java
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java  
>>> (original)
>>> +++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java  
>>> Wed Aug 13 07:57:20 2008
>>> @@ -91,7 +91,7 @@
>>> public long getStartTime() { return startTime; }
>>>
>>> /**
>>> -   * @deprecated Use {@link MultiCore#getCore(String)} instead.
>>> +   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
>>>  */
>>> @Deprecated
>>> private static SolrCore instance;
>>> @@ -345,7 +345,7 @@
>>>  * @return the last core initialized.  If you are using multiple  
>>> cores,
>>>  * this is not a function to use.
>>>  *
>>> -   * @deprecated Use {@link MultiCore#getCore(String)} instead.
>>> +   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
>>>  */
>>> @Deprecated
>>> public static SolrCore getSolrCore() {
>>>
>>> Copied: lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>>> CoreAdminHandler.java (from r685549, lucene/solr/trunk/src/java/ 
>>> org/apache/solr/handler/admin/MultiCoreHandler.java)
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?p2=lucene/solr/trunk/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java&p1=lucene/solr/trunk/src/java/org/apache/solr/handler/admin/MultiCoreHandler.java&r1=685549&r2=685577&rev=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>>> MultiCoreHandler.java (original)
>>> +++ lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>>> CoreAdminHandler.java Wed Aug 13 07:57:20 2008
>>> @@ -26,7 +26,7 @@
>>> import  
>>> org.apache.solr.common.params.MultiCoreParams.MultiCoreAction;
>>> import org.apache.solr.common.util.NamedList;
>>> import org.apache.solr.common.util.SimpleOrderedMap;
>>> -import org.apache.solr.core.MultiCore;
>>> +import org.apache.solr.core.CoreContainer;
>>> import org.apache.solr.core.SolrCore;
>>> import org.apache.solr.core.CoreDescriptor;
>>> import org.apache.solr.handler.RequestHandlerBase;
>>> @@ -39,12 +39,12 @@
>>> * @version $Id$
>>> * @since solr 1.3
>>> */
>>> -public abstract class MultiCoreHandler extends RequestHandlerBase
>>> +public abstract class CoreAdminHandler extends RequestHandlerBase
>>> {
>>> -  public MultiCoreHandler()
>>> +  public CoreAdminHandler()
>>> {
>>>   super();
>>> -    // Unlike most request handlers, MultiCore initialization
>>> +    // Unlike most request handlers, CoreContainer initialization
>>>   // should happen in the constructor...
>>> }
>>>
>>> @@ -52,25 +52,25 @@
>>> @Override
>>> final public void init(NamedList args) {
>>>   throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
>>> -        "MultiCoreHandler should not be configured in solrconf.xml 
>>> \n"+
>>> +        "CoreAdminHandler should not be configured in solrconf.xml 
>>> \n"+
>>>       "it is a special Handler configured directly by the  
>>> RequestDispatcher" );
>>> }
>>>
>>> /**
>>>  * The instance of multicore this handler handles.
>>> -   * This should be the MultiCore instance that created this  
>>> handler.
>>> -   * @return a MultiCore instance
>>> +   * This should be the CoreContainer instance that created this  
>>> handler.
>>> +   * @return a CoreContainer instance
>>>  */
>>> -  public abstract MultiCore getMultiCore();
>>> +  public abstract CoreContainer getMultiCore();
>>>
>>> @Override
>>> public void handleRequestBody(SolrQueryRequest req,  
>>> SolrQueryResponse rsp) throws Exception
>>> {
>>>   // Make sure the manager is enabled
>>> -    MultiCore manager = getMultiCore();
>>> +    CoreContainer manager = getMultiCore();
>>>   if( !manager.isEnabled() ) {
>>>     throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
>>> -          "MultiCore support must be enabled at startup." );
>>> +          "CoreContainer support must be enabled at startup." );
>>>   }
>>>   boolean do_persist = false;
>>>
>>>
>>> Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>>> SolrDispatchFilter.java
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>>> SolrDispatchFilter.java (original)
>>> +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>>> SolrDispatchFilter.java Wed Aug 13 07:57:20 2008
>>> @@ -52,7 +52,7 @@
>>>
>>> protected CoreDescriptor singleCoreDescriptor;
>>>
>>> -  protected MultiCore multicore;
>>> +  protected CoreContainer cores;
>>> protected String pathPrefix = null; // strip this from the  
>>> beginning of a path
>>> protected String abortErrorMessage = null;
>>> protected final WeakHashMap<SolrCore, SolrRequestParsers> parsers  
>>> = new WeakHashMap<SolrCore, SolrRequestParsers>();
>>> @@ -68,14 +68,14 @@
>>>     this.pathPrefix = config.getInitParameter( "path-prefix" );
>>>     this.solrConfigFilename = config.getInitParameter("solrconfig- 
>>> filename");
>>>
>>> -      // multicore instantiation
>>> -      this.multicore = initMultiCore(config);
>>> +      // cores instantiation
>>> +      this.cores = initMultiCore(config);
>>>
>>> -      if(multicore != null && multicore.isEnabled() ) {
>>> +      if(cores != null && cores.isEnabled() ) {
>>>       abortOnConfigurationError = false;
>>>       singleCoreDescriptor = null;
>>>       // if any core aborts on startup, then abort
>>> -        for( SolrCore c : multicore.getCores() ) {
>>> +        for( SolrCore c : cores.getCores() ) {
>>>          
>>> if 
>>> ( c.getSolrConfig().getBool( "abortOnConfigurationError",false) ) {
>>>           abortOnConfigurationError = true;
>>>           break;
>>> @@ -84,7 +84,7 @@
>>>     }
>>>     else {
>>>       SolrConfig cfg = this.solrConfigFilename == null? new  
>>> SolrConfig() : new SolrConfig(this.solrConfigFilename);
>>> -        singleCoreDescriptor = new CoreDescriptor((MultiCore)null);
>>> +        singleCoreDescriptor = new  
>>> CoreDescriptor((CoreContainer)null);
>>>        
>>> singleCoreDescriptor 
>>> .init("",cfg.getResourceLoader().getInstanceDir());
>>>       SolrCore singlecore = new SolrCore( null, null, cfg, null,  
>>> singleCoreDescriptor);
>>>       singleCoreDescriptor.setCore(singlecore);
>>> @@ -108,7 +108,7 @@
>>>     out.println( "Check your log files for more detailed  
>>> information on what may be wrong.\n" );
>>>     out.println( "If you want solr to continue after configuration  
>>> errors, change: \n");
>>>     out.println( " <abortOnConfigurationError>false</ 
>>> abortOnConfigurationError>\n" );
>>> -      if (multicore != null && multicore.isEnabled()) {
>>> +      if (cores != null && cores.isEnabled()) {
>>>       out.println( "in solr.xml\n" );
>>>     } else {
>>>       out.println( "in solrconfig.xml\n" );
>>> @@ -133,13 +133,13 @@
>>> }
>>>
>>> /**
>>> -   * Initialize the multicore instance.
>>> +   * Initialize the cores instance.
>>>  * @param config the filter configuration
>>> -   * @return the multicore instance or null
>>> +   * @return the cores instance or null
>>>  * @throws java.lang.Exception
>>>  */
>>> -  protected MultiCore initMultiCore(FilterConfig config) throws  
>>> Exception {
>>> -    MultiCore mcore = new MultiCore();
>>> +  protected CoreContainer initMultiCore(FilterConfig config)  
>>> throws Exception {
>>> +    CoreContainer mcore = new CoreContainer();
>>>   String instanceDir = SolrResourceLoader.locateInstanceDir();
>>>   File fconf = new File(instanceDir, "solr.xml");
>>>   log.info("looking for solr.xml: " + fconf.getAbsolutePath());
>>> @@ -151,9 +151,9 @@
>>>
>>>
>>> public void destroy() {
>>> -    if (multicore != null) {
>>> -    multicore.shutdown();
>>> -      multicore = null;
>>> +    if (cores != null) {
>>> +    cores.shutdown();
>>> +      cores = null;
>>>   }
>>>   if( singleCoreDescriptor != null ) {
>>>     singleCoreDescriptor.getCore().close();
>>> @@ -189,18 +189,18 @@
>>>         path = path.substring( 0, idx );
>>>       }
>>>
>>> -        // By default use the single core.  If multicore is  
>>> enabled, look for one.
>>> +        // By default use the single core.  If cores is enabled,  
>>> look for one.
>>>       final SolrCore core;
>>> -        if (multicore != null && multicore.isEnabled()) {
>>> -          req.setAttribute("org.apache.solr.MultiCore", multicore);
>>> +        if (cores != null && cores.isEnabled()) {
>>> +          req.setAttribute("org.apache.solr.CoreContainer", cores);
>>>
>>>         // if this is the multi-core admin page, it will handle it
>>> -          if( path.equals( multicore.getAdminPath() ) ) {
>>> -            handler = multicore.getMultiCoreHandler();
>>> +          if( path.equals( cores.getAdminPath() ) ) {
>>> +            handler = cores.getMultiCoreHandler();
>>>           // pick a core to use for output generation
>>> -            core = multicore.getAdminCore();
>>> +            core = cores.getAdminCore();
>>>           if( core == null ) {
>>> -              throw new RuntimeException( "Can not find a valid  
>>> core for the multicore admin handler" );
>>> +              throw new RuntimeException( "Can not find a valid  
>>> core for the cores admin handler" );
>>>           }
>>>         } else {
>>>           //otherwise, we should find a core from the path
>>> @@ -209,7 +209,7 @@
>>>             // try to get the corename as a request parameter first
>>>             String corename = path.substring( 1, idx );
>>>             path = path.substring( idx );
>>> -              core = multicore.getCore( corename );
>>> +              core = cores.getCore( corename );
>>>           } else {
>>>             core = null;
>>>           }
>>> @@ -231,7 +231,7 @@
>>>         }
>>>
>>>         // Determine the handler from the url path if not set
>>> -          // (we might already have selected the multicore handler)
>>> +          // (we might already have selected the cores handler)
>>>         if( handler == null && path.length() > 1 ) { // don't  
>>> match "" or "/" as valid path
>>>           handler = core.getRequestHandler( path );
>>>           // no handler yet but allowed to handle select; let's  
>>> check
>>>
>>> Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/index.jsp?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original)
>>> +++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Wed Aug 13  
>>> 07:57:20 2008
>>> @@ -52,7 +52,7 @@
>>> </tr>
>>>
>>> <%-- List the cores (that arent this one) so we can switch --%>
>>> -<% org.apache.solr.core.MultiCore multicore =  
>>> (org 
>>> .apache 
>>> .solr 
>>> .core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
>>> +<% org.apache.solr.core.CoreContainer multicore =  
>>> (org 
>>> .apache 
>>> .solr 
>>> .core 
>>> .CoreContainer 
>>> )request.getAttribute("org.apache.solr.CoreContainer");
>>> if (multicore!=null) {
>>> java.util.Collection<SolrCore> cores = multicore.getCores();
>>> if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></ 
>>> td><td><%
>>>
>>> Modified: lucene/solr/trunk/src/webapp/web/index.jsp
>>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/index.jsp?rev=685577&r1=685576&r2=685577&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- lucene/solr/trunk/src/webapp/web/index.jsp (original)
>>> +++ lucene/solr/trunk/src/webapp/web/index.jsp Wed Aug 13 07:57:20  
>>> 2008
>>> @@ -28,7 +28,7 @@
>>> <a href="."><img border="0" align="right" height="61" width="142"  
>>> src="admin/solr-head.gif" alt="Solr"/></a>
>>>
>>> <%
>>> -  org.apache.solr.core.MultiCore multicore =  
>>> (org 
>>> .apache 
>>> .solr 
>>> .core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
>>> +  org.apache.solr.core.CoreContainer multicore =  
>>> (org 
>>> .apache 
>>> .solr 
>>> .core 
>>> .CoreContainer 
>>> )request.getAttribute("org.apache.solr.CoreContainer");
>>> if(multicore != null && multicore.isEnabled() ) {
>>>   for( org.apache.solr.core.SolrCore core : multicore.getCores() )  
>>> {%>
>>> <a href="<%= core.getName() %>/admin/">Admin <%= core.getName()  
>>> %></a><br/>
>>>
>>>
>


Re: svn commit: r685577 - in /lucene/solr/trunk: client/java/solrj/src/org/apache/solr/client/solrj/embedded/ client/java/solrj/test/org/apache/solr/client/solrj/ client/java/solrj/test/org/apache/solr/client/solrj/embedded/ example/solr/conf/ src/java/org...

Posted by Grant Ingersoll <gs...@apache.org>.
Here's a _possible_ patch:

Index: src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
===================================================================
--- src/webapp/src/org/apache/solr/servlet/ 
SolrDispatchFilter.java      (revision 686097)
+++ src/webapp/src/org/apache/solr/servlet/ 
SolrDispatchFilter.java      (working copy)
@@ -64,7 +64,9 @@
      try {
        // web.xml configuration
        init.setPathPrefix(config.getInitParameter( "path-prefix" ));
+      this.pathPrefix = init.getPathPrefix();
        init.setSolrConfigFilename(config.getInitParameter("solrconfig- 
filename"));
+      this.solrConfigFilename = init.getSolrConfigFilename();

        this.cores = init.initialize();
        abortOnConfigurationError = init.isAbortOnConfigurationError();


-Grant


On Aug 14, 2008, at 8:56 PM, Grant Ingersoll wrote:

> Hey Ryan,
>
> Something's messed up with this commit in regards to the  
> SolrDispatchFilter.  It appears the pathPrefix is no longer being  
> set.  It gets set on the CoreContainer.Initializer(), but then the  
> code later checks to see if the SolrDispatchFilter.pathPrefix is set  
> and the path prefix on the init is ignored (not that it could use  
> it, since it is out of scope anyway).
>
> Not sure how you want to handle setting the pathPrefix in the SDF.   
> It's easy enough to do, just not sure on the relation between the  
> Initializer and the member variables in SDF.
>
> -Grant
>
> On Aug 13, 2008, at 10:57 AM, ryan@apache.org wrote:
>
>> Author: ryan
>> Date: Wed Aug 13 07:57:20 2008
>> New Revision: 685577
>>
>> URL: http://svn.apache.org/viewvc?rev=685577&view=rev
>> Log:
>> SOLR-695 -- refactoring MultiCore to CoreContainer
>>
>> Added:
>>   lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java
>>     - copied, changed from r685549, lucene/solr/trunk/src/java/org/ 
>> apache/solr/core/MultiCore.java
>>   lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>> CoreAdminHandler.java
>>     - copied, changed from r685549, lucene/solr/trunk/src/java/org/ 
>> apache/solr/handler/admin/MultiCoreHandler.java
>> Removed:
>>   lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java
>>   lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>> MultiCoreHandler.java
>> Modified:
>>   lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
>> solrj/embedded/EmbeddedSolrServer.java
>>   lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>> solrj/MultiCoreExampleTestBase.java
>>   lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>> solrj/embedded/JettyWebappTest.java
>>   lucene/solr/trunk/example/solr/conf/schema.xml
>>   lucene/solr/trunk/src/java/org/apache/solr/core/CoreDescriptor.java
>>   lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
>>   lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>> SolrDispatchFilter.java
>>   lucene/solr/trunk/src/webapp/web/admin/index.jsp
>>   lucene/solr/trunk/src/webapp/web/index.jsp
>>
>> Modified: lucene/solr/trunk/client/java/solrj/src/org/apache/solr/ 
>> client/solrj/embedded/EmbeddedSolrServer.java
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
>> solrj/embedded/EmbeddedSolrServer.java (original)
>> +++ lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/ 
>> solrj/embedded/EmbeddedSolrServer.java Wed Aug 13 07:57:20 2008
>> @@ -34,7 +34,7 @@
>> import org.apache.solr.common.params.ModifiableSolrParams;
>> import org.apache.solr.common.params.SolrParams;
>> import org.apache.solr.common.util.NamedList;
>> -import org.apache.solr.core.MultiCore;
>> +import org.apache.solr.core.CoreContainer;
>> import org.apache.solr.core.SolrCore;
>> import org.apache.solr.request.BinaryResponseWriter;
>> import org.apache.solr.request.QueryResponseWriter;
>> @@ -55,9 +55,9 @@
>> public class EmbeddedSolrServer extends SolrServer
>> {
>>
>> -  protected final MultiCore multicore; // either multicore
>> +  protected final CoreContainer multicore; // either multicore
>>  protected final SolrCore core; // or single core
>> -  protected final String coreName;  // use MultiCore registry
>> +  protected final String coreName;  // use CoreContainer registry
>>
>>  private final SolrRequestParsers _parser;
>>
>> @@ -73,10 +73,10 @@
>>    _parser = new SolrRequestParsers( null );
>>  }
>>
>> -  public EmbeddedSolrServer(  MultiCore multicore, String coreName )
>> +  public EmbeddedSolrServer(  CoreContainer multicore, String  
>> coreName )
>>  {
>>    if ( multicore == null ) {
>> -      throw new NullPointerException("MultiCore instance required");
>> +      throw new NullPointerException("CoreContainer instance  
>> required");
>>    }
>>    this.core = null;
>>    this.multicore = multicore;
>>
>> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>> client/solrj/MultiCoreExampleTestBase.java
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>> solrj/MultiCoreExampleTestBase.java (original)
>> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>> solrj/MultiCoreExampleTestBase.java Wed Aug 13 07:57:20 2008
>> @@ -25,7 +25,7 @@
>> import org.apache.solr.client.solrj.request.UpdateRequest.ACTION;
>> import org.apache.solr.client.solrj.response.MultiCoreResponse;
>> import org.apache.solr.common.SolrInputDocument;
>> -import org.apache.solr.core.MultiCore;
>> +import org.apache.solr.core.CoreContainer;
>>
>>
>> /**
>> @@ -34,7 +34,7 @@
>> */
>> public abstract class MultiCoreExampleTestBase extends  
>> SolrExampleTestBase
>> {
>> -  protected static final MultiCore multicore = new MultiCore();
>> +  protected static final CoreContainer multicore = new  
>> CoreContainer();
>>
>>  @Override public String getSolrHome() { return "../../../example/ 
>> multicore/"; }
>>
>>
>> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/ 
>> client/solrj/embedded/JettyWebappTest.java
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>> solrj/embedded/JettyWebappTest.java (original)
>> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/ 
>> solrj/embedded/JettyWebappTest.java Wed Aug 13 07:57:20 2008
>> @@ -76,6 +76,7 @@
>>    assertNotNull( html ); // real error will be an exception
>>
>>    adminPath += "admin/";
>> +    html = IOUtils.toString( new URL(adminPath).openStream() );
>>    assertNotNull( html ); // real error will be an exception
>>
>>    // analysis
>>
>> Modified: lucene/solr/trunk/example/solr/conf/schema.xml
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/example/solr/conf/schema.xml (original)
>> +++ lucene/solr/trunk/example/solr/conf/schema.xml Wed Aug 13  
>> 07:57:20 2008
>> @@ -204,6 +204,14 @@
>>      </analyzer>
>>    </fieldType>
>>
>> +    <fieldType name="grams" class="solr.TextField"  
>> positionIncrementGap="100" >
>> +      <analyzer>
>> +        <tokenizer class="solr.StandardTokenizerFactory"/>
>> +        <filter class="solr.WordDelimiterFilterFactory"  
>> generateWordParts="1" generateNumberParts="1" catenateWords="0"  
>> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
>> +        <filter class="solr.LengthFilterFactory" min="3" max="15" />
>> +        <filter class="solr.WordGramFilterFactory" minLength="1"  
>> maxLength="3" sep=" " />
>> +      </analyzer>
>> +    </fieldType>
>>
>>    <!--
>>     Setup simple analysis for spell checking
>>
>> Copied: lucene/solr/trunk/src/java/org/apache/solr/core/ 
>> CoreContainer.java (from r685549, lucene/solr/trunk/src/java/org/ 
>> apache/solr/core/MultiCore.java)
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java?p2=lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java&p1=lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java&r1=685549&r2=685577&rev=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java  
>> (original)
>> +++ lucene/solr/trunk/src/java/org/apache/solr/core/ 
>> CoreContainer.java Wed Aug 13 07:57:20 2008
>> @@ -36,7 +36,7 @@
>> import org.apache.solr.common.SolrException;
>> import org.apache.solr.common.util.DOMUtil;
>> import org.apache.solr.common.util.XML;
>> -import org.apache.solr.handler.admin.MultiCoreHandler;
>> +import org.apache.solr.handler.admin.CoreAdminHandler;
>> import org.apache.solr.schema.IndexSchema;
>> import org.w3c.dom.Node;
>> import org.w3c.dom.NodeList;
>> @@ -47,27 +47,27 @@
>> * @version $Id$
>> * @since solr 1.3
>> */
>> -public class MultiCore
>> +public class CoreContainer
>> {
>> -  protected static Logger log =  
>> Logger.getLogger(MultiCore.class.getName());
>> +  protected static Logger log =  
>> Logger.getLogger(CoreContainer.class.getName());
>>
>>  protected final Map<String, CoreDescriptor> cores = new  
>> LinkedHashMap<String, CoreDescriptor>();
>>  protected boolean enabled = false;
>>  protected boolean persistent = false;
>>  protected String adminPath = null;
>> -  protected MultiCoreHandler multiCoreHandler = null;
>> +  protected CoreAdminHandler coreAdminHandler = null;
>>  protected File configFile = null;
>>  protected String libDir = null;
>>  protected ClassLoader libLoader = null;
>>  protected SolrResourceLoader loader = null;
>>  protected java.lang.ref.WeakReference<SolrCore> adminCore = null;
>>
>> -  public MultiCore() {
>> +  public CoreContainer() {
>>
>>  }
>>
>>  /**
>> -   * Initalize MultiCore directly from the constructor
>> +   * Initalize CoreContainer directly from the constructor
>>   *
>>   * @param dir
>>   * @param configFile
>> @@ -75,7 +75,7 @@
>>   * @throws IOException
>>   * @throws SAXException
>>   */
>> -  public MultiCore(String dir, File configFile ) throws  
>> ParserConfigurationException, IOException, SAXException
>> +  public CoreContainer(String dir, File configFile ) throws  
>> ParserConfigurationException, IOException, SAXException
>>  {
>>    this.load(dir, configFile);
>>  }
>> @@ -113,7 +113,7 @@
>>      }
>>
>>      if( adminPath != null ) {
>> -        multiCoreHandler = this.createMultiCoreHandler();
>> +        coreAdminHandler = this.createMultiCoreHandler();
>>      }
>>
>>      NodeList nodes = (NodeList)cfg.evaluate("solr/cores/core",  
>> XPathConstants.NODESET);
>> @@ -357,9 +357,9 @@
>>  }
>>
>>  /**
>> -   * Sets the preferred core used to handle MultiCore admin tasks.
>> +   * Sets the preferred core used to handle CoreContainer admin  
>> tasks.
>>   * Note that getAdminCore is not symmetrical to this method since
>> -   * it will allways return an opened SolrCore.
>> +   * it will always return an opened SolrCore.
>>   * This however can be useful implementing a "metacore" (a core of  
>> cores).
>>   */
>>  public void setAdminCore(SolrCore core) {
>> @@ -369,8 +369,8 @@
>>  }
>>
>>  /**
>> -   * Gets a core to handle MultiCore admin tasks (@see  
>> SolrDispatchFilter).
>> -   * This makes the best attempt to reuse the same opened SolrCore  
>> accross calls.
>> +   * Gets a core to handle CoreContainer admin tasks (@see  
>> SolrDispatchFilter).
>> +   * This makes the best attempt to reuse the same opened SolrCore  
>> across calls.
>>   */
>>  public SolrCore getAdminCore() {
>>    synchronized (cores) {
>> @@ -391,20 +391,20 @@
>>  }
>>
>>  /**
>> -   * Creates a MultiCoreHandler for this MultiCore.
>> -   * @return a MultiCoreHandler
>> +   * Creates a CoreAdminHandler for this CoreContainer.
>> +   * @return a CoreAdminHandler
>>   */
>> -  protected MultiCoreHandler createMultiCoreHandler() {
>> -    return new MultiCoreHandler() {
>> +  protected CoreAdminHandler createMultiCoreHandler() {
>> +    return new CoreAdminHandler() {
>>      @Override
>> -      public MultiCore getMultiCore() {
>> -        return MultiCore.this;
>> +      public CoreContainer getMultiCore() {
>> +        return CoreContainer.this;
>>      }
>>    };
>>  }
>>
>> -  public MultiCoreHandler getMultiCoreHandler() {
>> -    return multiCoreHandler;
>> +  public CoreAdminHandler getMultiCoreHandler() {
>> +    return coreAdminHandler;
>>  }
>>
>>  public File getConfigFile() {
>>
>> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/ 
>> CoreDescriptor.java
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreDescriptor.java?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/java/org/apache/solr/core/ 
>> CoreDescriptor.java (original)
>> +++ lucene/solr/trunk/src/java/org/apache/solr/core/ 
>> CoreDescriptor.java Wed Aug 13 07:57:20 2008
>> @@ -17,13 +17,10 @@
>>
>> package org.apache.solr.core;
>>
>> -import org.xml.sax.SAXException;
>> -
>> -import javax.xml.parsers.ParserConfigurationException;
>> -import java.io.IOException;
>>
>> /**
>> * A Solr core descriptor
>> + *
>> * @since solr 1.3
>> */
>> public class CoreDescriptor implements Cloneable {
>> @@ -32,10 +29,10 @@
>>  protected String configName;
>>  protected String schemaName;
>>  protected SolrCore core = null;
>> -  private final MultiCore multiCore;
>> +  private final CoreContainer coreContainer;
>>
>> -  public CoreDescriptor(MultiCore multiCore) {
>> -    this.multiCore = multiCore;
>> +  public CoreDescriptor(CoreContainer coreContainer) {
>> +    this.coreContainer = coreContainer;
>>  }
>>
>>  /** Initialize defaults from instance directory. */
>> @@ -58,7 +55,7 @@
>>    this.instanceDir = descr.instanceDir;
>>    this.configName = descr.configName;
>>    this.schemaName = descr.schemaName;
>> -    multiCore = descr.multiCore;
>> +    coreContainer = descr.coreContainer;
>>  }
>>
>>  /**@return the default config name. */
>> @@ -123,7 +120,7 @@
>>    this.core = core;
>>  }
>>
>> -  public MultiCore getMultiCore() {
>> -    return multiCore;
>> +  public CoreContainer getMultiCore() {
>> +    return coreContainer;
>>  }
>> }
>>
>> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/ 
>> SolrCore.java
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java  
>> (original)
>> +++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java  
>> Wed Aug 13 07:57:20 2008
>> @@ -91,7 +91,7 @@
>>  public long getStartTime() { return startTime; }
>>
>>  /**
>> -   * @deprecated Use {@link MultiCore#getCore(String)} instead.
>> +   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
>>   */
>>  @Deprecated
>>  private static SolrCore instance;
>> @@ -345,7 +345,7 @@
>>   * @return the last core initialized.  If you are using multiple  
>> cores,
>>   * this is not a function to use.
>>   *
>> -   * @deprecated Use {@link MultiCore#getCore(String)} instead.
>> +   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
>>   */
>>  @Deprecated
>>  public static SolrCore getSolrCore() {
>>
>> Copied: lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>> CoreAdminHandler.java (from r685549, lucene/solr/trunk/src/java/org/ 
>> apache/solr/handler/admin/MultiCoreHandler.java)
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?p2=lucene/solr/trunk/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java&p1=lucene/solr/trunk/src/java/org/apache/solr/handler/admin/MultiCoreHandler.java&r1=685549&r2=685577&rev=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>> MultiCoreHandler.java (original)
>> +++ lucene/solr/trunk/src/java/org/apache/solr/handler/admin/ 
>> CoreAdminHandler.java Wed Aug 13 07:57:20 2008
>> @@ -26,7 +26,7 @@
>> import org.apache.solr.common.params.MultiCoreParams.MultiCoreAction;
>> import org.apache.solr.common.util.NamedList;
>> import org.apache.solr.common.util.SimpleOrderedMap;
>> -import org.apache.solr.core.MultiCore;
>> +import org.apache.solr.core.CoreContainer;
>> import org.apache.solr.core.SolrCore;
>> import org.apache.solr.core.CoreDescriptor;
>> import org.apache.solr.handler.RequestHandlerBase;
>> @@ -39,12 +39,12 @@
>> * @version $Id$
>> * @since solr 1.3
>> */
>> -public abstract class MultiCoreHandler extends RequestHandlerBase
>> +public abstract class CoreAdminHandler extends RequestHandlerBase
>> {
>> -  public MultiCoreHandler()
>> +  public CoreAdminHandler()
>>  {
>>    super();
>> -    // Unlike most request handlers, MultiCore initialization
>> +    // Unlike most request handlers, CoreContainer initialization
>>    // should happen in the constructor...
>>  }
>>
>> @@ -52,25 +52,25 @@
>>  @Override
>>  final public void init(NamedList args) {
>>    throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
>> -        "MultiCoreHandler should not be configured in solrconf.xml 
>> \n"+
>> +        "CoreAdminHandler should not be configured in solrconf.xml 
>> \n"+
>>        "it is a special Handler configured directly by the  
>> RequestDispatcher" );
>>  }
>>
>>  /**
>>   * The instance of multicore this handler handles.
>> -   * This should be the MultiCore instance that created this  
>> handler.
>> -   * @return a MultiCore instance
>> +   * This should be the CoreContainer instance that created this  
>> handler.
>> +   * @return a CoreContainer instance
>>   */
>> -  public abstract MultiCore getMultiCore();
>> +  public abstract CoreContainer getMultiCore();
>>
>>  @Override
>>  public void handleRequestBody(SolrQueryRequest req,  
>> SolrQueryResponse rsp) throws Exception
>>  {
>>    // Make sure the manager is enabled
>> -    MultiCore manager = getMultiCore();
>> +    CoreContainer manager = getMultiCore();
>>    if( !manager.isEnabled() ) {
>>      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
>> -          "MultiCore support must be enabled at startup." );
>> +          "CoreContainer support must be enabled at startup." );
>>    }
>>    boolean do_persist = false;
>>
>>
>> Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>> SolrDispatchFilter.java
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>> SolrDispatchFilter.java (original)
>> +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ 
>> SolrDispatchFilter.java Wed Aug 13 07:57:20 2008
>> @@ -52,7 +52,7 @@
>>
>>  protected CoreDescriptor singleCoreDescriptor;
>>
>> -  protected MultiCore multicore;
>> +  protected CoreContainer cores;
>>  protected String pathPrefix = null; // strip this from the  
>> beginning of a path
>>  protected String abortErrorMessage = null;
>>  protected final WeakHashMap<SolrCore, SolrRequestParsers> parsers  
>> = new WeakHashMap<SolrCore, SolrRequestParsers>();
>> @@ -68,14 +68,14 @@
>>      this.pathPrefix = config.getInitParameter( "path-prefix" );
>>      this.solrConfigFilename = config.getInitParameter("solrconfig- 
>> filename");
>>
>> -      // multicore instantiation
>> -      this.multicore = initMultiCore(config);
>> +      // cores instantiation
>> +      this.cores = initMultiCore(config);
>>
>> -      if(multicore != null && multicore.isEnabled() ) {
>> +      if(cores != null && cores.isEnabled() ) {
>>        abortOnConfigurationError = false;
>>        singleCoreDescriptor = null;
>>        // if any core aborts on startup, then abort
>> -        for( SolrCore c : multicore.getCores() ) {
>> +        for( SolrCore c : cores.getCores() ) {
>>           
>> if( c.getSolrConfig().getBool( "abortOnConfigurationError",false) ) {
>>            abortOnConfigurationError = true;
>>            break;
>> @@ -84,7 +84,7 @@
>>      }
>>      else {
>>        SolrConfig cfg = this.solrConfigFilename == null? new  
>> SolrConfig() : new SolrConfig(this.solrConfigFilename);
>> -        singleCoreDescriptor = new CoreDescriptor((MultiCore)null);
>> +        singleCoreDescriptor = new  
>> CoreDescriptor((CoreContainer)null);
>>         
>> singleCoreDescriptor 
>> .init("",cfg.getResourceLoader().getInstanceDir());
>>        SolrCore singlecore = new SolrCore( null, null, cfg, null,  
>> singleCoreDescriptor);
>>        singleCoreDescriptor.setCore(singlecore);
>> @@ -108,7 +108,7 @@
>>      out.println( "Check your log files for more detailed  
>> information on what may be wrong.\n" );
>>      out.println( "If you want solr to continue after configuration  
>> errors, change: \n");
>>      out.println( " <abortOnConfigurationError>false</ 
>> abortOnConfigurationError>\n" );
>> -      if (multicore != null && multicore.isEnabled()) {
>> +      if (cores != null && cores.isEnabled()) {
>>        out.println( "in solr.xml\n" );
>>      } else {
>>        out.println( "in solrconfig.xml\n" );
>> @@ -133,13 +133,13 @@
>>  }
>>
>>  /**
>> -   * Initialize the multicore instance.
>> +   * Initialize the cores instance.
>>   * @param config the filter configuration
>> -   * @return the multicore instance or null
>> +   * @return the cores instance or null
>>   * @throws java.lang.Exception
>>   */
>> -  protected MultiCore initMultiCore(FilterConfig config) throws  
>> Exception {
>> -    MultiCore mcore = new MultiCore();
>> +  protected CoreContainer initMultiCore(FilterConfig config)  
>> throws Exception {
>> +    CoreContainer mcore = new CoreContainer();
>>    String instanceDir = SolrResourceLoader.locateInstanceDir();
>>    File fconf = new File(instanceDir, "solr.xml");
>>    log.info("looking for solr.xml: " + fconf.getAbsolutePath());
>> @@ -151,9 +151,9 @@
>>
>>
>>  public void destroy() {
>> -    if (multicore != null) {
>> -    multicore.shutdown();
>> -      multicore = null;
>> +    if (cores != null) {
>> +    cores.shutdown();
>> +      cores = null;
>>    }
>>    if( singleCoreDescriptor != null ) {
>>      singleCoreDescriptor.getCore().close();
>> @@ -189,18 +189,18 @@
>>          path = path.substring( 0, idx );
>>        }
>>
>> -        // By default use the single core.  If multicore is  
>> enabled, look for one.
>> +        // By default use the single core.  If cores is enabled,  
>> look for one.
>>        final SolrCore core;
>> -        if (multicore != null && multicore.isEnabled()) {
>> -          req.setAttribute("org.apache.solr.MultiCore", multicore);
>> +        if (cores != null && cores.isEnabled()) {
>> +          req.setAttribute("org.apache.solr.CoreContainer", cores);
>>
>>          // if this is the multi-core admin page, it will handle it
>> -          if( path.equals( multicore.getAdminPath() ) ) {
>> -            handler = multicore.getMultiCoreHandler();
>> +          if( path.equals( cores.getAdminPath() ) ) {
>> +            handler = cores.getMultiCoreHandler();
>>            // pick a core to use for output generation
>> -            core = multicore.getAdminCore();
>> +            core = cores.getAdminCore();
>>            if( core == null ) {
>> -              throw new RuntimeException( "Can not find a valid  
>> core for the multicore admin handler" );
>> +              throw new RuntimeException( "Can not find a valid  
>> core for the cores admin handler" );
>>            }
>>          } else {
>>            //otherwise, we should find a core from the path
>> @@ -209,7 +209,7 @@
>>              // try to get the corename as a request parameter first
>>              String corename = path.substring( 1, idx );
>>              path = path.substring( idx );
>> -              core = multicore.getCore( corename );
>> +              core = cores.getCore( corename );
>>            } else {
>>              core = null;
>>            }
>> @@ -231,7 +231,7 @@
>>          }
>>
>>          // Determine the handler from the url path if not set
>> -          // (we might already have selected the multicore handler)
>> +          // (we might already have selected the cores handler)
>>          if( handler == null && path.length() > 1 ) { // don't  
>> match "" or "/" as valid path
>>            handler = core.getRequestHandler( path );
>>            // no handler yet but allowed to handle select; let's  
>> check
>>
>> Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/index.jsp?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original)
>> +++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Wed Aug 13  
>> 07:57:20 2008
>> @@ -52,7 +52,7 @@
>> </tr>
>>
>> <%-- List the cores (that arent this one) so we can switch --%>
>> -<% org.apache.solr.core.MultiCore multicore =  
>> (org 
>> .apache 
>> .solr 
>> .core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
>> +<% org.apache.solr.core.CoreContainer multicore =  
>> (org 
>> .apache 
>> .solr 
>> .core 
>> .CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
>>  if (multicore!=null) {
>>  java.util.Collection<SolrCore> cores = multicore.getCores();
>> if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></ 
>> td><td><%
>>
>> Modified: lucene/solr/trunk/src/webapp/web/index.jsp
>> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/index.jsp?rev=685577&r1=685576&r2=685577&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- lucene/solr/trunk/src/webapp/web/index.jsp (original)
>> +++ lucene/solr/trunk/src/webapp/web/index.jsp Wed Aug 13 07:57:20  
>> 2008
>> @@ -28,7 +28,7 @@
>> <a href="."><img border="0" align="right" height="61" width="142"  
>> src="admin/solr-head.gif" alt="Solr"/></a>
>>
>> <%
>> -  org.apache.solr.core.MultiCore multicore =  
>> (org 
>> .apache 
>> .solr 
>> .core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
>> +  org.apache.solr.core.CoreContainer multicore =  
>> (org 
>> .apache 
>> .solr 
>> .core 
>> .CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
>>  if(multicore != null && multicore.isEnabled() ) {
>>    for( org.apache.solr.core.SolrCore core : multicore.getCores() )  
>> {%>
>> <a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %></ 
>> a><br/>
>>
>>