<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<!--
 This is a stripped down config file used for a simple example...  
 It is *not* a good example to work from. 
-->
<config>
  <luceneMatchVersion>4.7</luceneMatchVersion>
  <!--  The DirectoryFactory to use for indexes.
        solr.StandardDirectoryFactory, the default, is filesystem based.
        solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
  <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>

  <dataDir>${solr.core0.data.dir:}</dataDir>

  <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
  
       <schemaFactory class="ManagedIndexSchemaFactory">
         <bool name="mutable">true</bool>
         <str name="managedSchemaResourceName">managed-schema</str>
       </schemaFactory>
       
       When ManagedIndexSchemaFactory is specified, Solr will load the schema from
       he resource named in 'managedSchemaResourceName', rather than from schema.xml.
       Note that the managed schema resource CANNOT be named schema.xml.  If the managed
       schema does not exist, Solr will create it after reading schema.xml, then rename
       'schema.xml' to 'schema.xml.bak'. 
       
       Do NOT hand edit the managed schema - external modifications will be ignored and
       overwritten as a result of schema modification REST API calls.

       When ManagedIndexSchemaFactory is specified with mutable = true, schema
       modification REST API calls will be allowed; otherwise, error responses will be
       sent back for these requests. 
  -->
  <schemaFactory class="ClassicIndexSchemaFactory"/>

  <updateHandler class="solr.DirectUpdateHandler2">
    <updateLog>
      <str name="dir">${solr.core0.data.dir:}</str>
    </updateLog>
  </updateHandler>

  <!-- realtime get handler, guaranteed to return the latest stored fields 
    of any document, without the need to commit or open a new searcher. The current 
    implementation relies on the updateLog feature being enabled. -->
  <requestHandler name="/get" class="solr.RealTimeGetHandler">
    <lst name="defaults">
      <str name="omitHeader">true</str>
    </lst>
  </requestHandler>  
  
  <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy">
    <lst name="master">
      <str name="enable">${enable.master:false}</str>
      <str name="replicateAfter">startup</str>
      <str name="replicateAfter">commit</str>
      <str name="replicateAfter">optimize</str>
      <str name="confFiles">schema.xml,stopwords.txt</str>
    </lst>
    <lst name="slave">
      <str name="enable">${enable.slave:false}</str>
      <str name="masterUrl">http://@@hostname@@:8983/solr/${solr.core.name}/replication</str>
      <str name="pollInterval">01:00:00</str>
    </lst>
  </requestHandler>

  <requestDispatcher handleSelect="true" >
    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
  </requestDispatcher>
  
  <!-- ESGF request handler -->
  <requestHandler name="standard" class="solr.StandardRequestHandler" default="true">

     <!-- default values for query parameters -->
     <lst name="defaults">
       <str name="echoParams">all</str>
       <int name="rows">10</int>
       <str name="fl">*,score</str>
       <str name="qf">text</str>
       <str name="df">text</str>
       <float name="tie">0.01</float>
       <!-- default query to match all documents> -->
       <str name="q.alt">*:*</str>
       <!-- filter out replicas by default 
       <str name="fq">-master_id:[* TO *]</str> -->
     </lst>

     <!-- always perform faceted search -->
     <lst name="invariants">
        <str name="facet">true</str>
        <!-- sort facet values lexographically (as opposed by count) -->
        <str name="facet.sort">lex</str>
        <!-- return ALL facet values (no limit) -->
        <str name="facet.limit">-1</str>
        <!-- return only facet values that match one or more documents -->
        <str name="facet.mincount">1</str>
        <str name="facet.method">enum</str>
        <!-- shards parameters to be supported in Solr 4.0
        <bool name="shards.info">true</bool>
        <bool name="shards.tolerant">true</bool> -->
     </lst>

     <!-- distributed search parameters -->
     <int name="shard-socket-timeout">10000</int>
     <int name="shard-connection-timeout">10000</int>
     <str name="partial-results">true</str>

  </requestHandler>

  <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
  <requestHandler name="/update" class="solr.UpdateRequestHandler"  />
  <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
     
  <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
    <lst name="invariants">
      <str name="q">solrpingquery</str>
    </lst>
    <lst name="defaults">
      <str name="echoParams">all</str>
    </lst>
  </requestHandler>
   
  <!-- config for the admin interface --> 
  <admin>
    <defaultQuery>solr</defaultQuery>
  </admin>

</config>

