<?xml version="1.0" encoding="UTF-8" ?>
<schema name="fedora-packages" version="1.6">
  <field name="_version_" type="plong" indexed="false" stored="false"/>
  <field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
  <field name="_nest_path_" type="_nest_path_" />
  <fieldType name="_nest_path_" class="solr.NestPathField" />

  <!-- TODO: tokenize lib out of package names? -->
  <fieldType name="nameText" class="solr.TextField">
    <analyzer type="index">
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.WordDelimiterGraphFilterFactory" preserveOriginal="1" />
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.FlattenGraphFilterFactory"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.WordDelimiterGraphFilterFactory" preserveOriginal="1" />
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
  </fieldType>
  <!-- Need this for https://pagure.io/fedora-packages-static/issue/29 -->
  <fieldType name="lowerFirstNameText" class="solr.TextField">
    <analyzer type="index">
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.WordDelimiterGraphFilterFactory" preserveOriginal="1" />
      <filter class="solr.FlattenGraphFilterFactory"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.WordDelimiterGraphFilterFactory" preserveOriginal="1" />
    </analyzer>
  </fieldType>
  <fieldType name="descText" class="solr.SortableTextField" positionIncrementGap="100" uninvertible="false">
    <analyzer type="index">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.PatternReplaceFilterFactory" pattern="\n" replacement=" "/>
      <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt" />
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.EnglishPossessiveFilterFactory"/>
      <filter class="solr.PorterStemFilterFactory"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt" />
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.EnglishPossessiveFilterFactory"/>
      <filter class="solr.PorterStemFilterFactory"/>
    </analyzer>
  </fieldType>

  <fieldType name="plong" class="solr.LongPointField" docValues="true"/>
  <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>

  <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
  <uniqueKey>id</uniqueKey>

  <!-- Package name-->
  <field name="name" type="nameText" indexed="true" stored="true" multiValued="false" required="true"/>
  <field name="nameLower" type="lowerFirstNameText" indexed="true" stored="false" multiValued="false" required="true"/>
  <copyField source="name" dest="nameLower" />
  <!-- source package name-->
  <field name="srcName" type="nameText" indexed="true" stored="true" multiValued="false" required="true"/>
  <field name="srcNameLower" type="lowerFirstNameText" indexed="true" stored="false" multiValued="false" required="true"/>
  <field name="srcName_string" type="string" indexed="false" stored="false" multiValued="false" docValues="true" required="true"/>
  <copyField source="srcName" dest="srcNameLower" />
  <copyField source="srcName" dest="srcName_string" />
  <!-- Package summary -->
  <field name="summary" type="descText" indexed="true" stored="true" multiValued="false" />
  <!-- Releases package is in -->
  <field name="releases" type="string" indexed="false" stored="true" multiValued="true" docValues="true" />
</schema>
