solr reindexing issue for EdgeNgramFilter

78 views Asked by At

I have created a rails application with Solr search(sunspot gem). It is working good in my local system but when I deployed to production server, I faced a serious problem.

When I run the re-indexing command RAILS_ENV=development bundle exec rake sunspot:solr:start, it's not showing any error. It successfully re-index the data. It also showing at the admin side that all data is re-indexed properly.

But when I search something, it's not giving the proper result. And when I execute the same search query in my local machine it gave the proper relevant result.

There is also weird behavior in server: when I did manually changes in the file and did Solr start stop without re-index. Then it will give proper result.

I use the following command for re-indexing the solr RAILS_ENV=development bundle exec rake sunspot:solr:reindex

Here is my schema.xml file:

<?xml version="1.0" encoding="UTF-8"?>
  <schema name="sunspot" version="1.0">
    <types>
      <fieldType name="string" class="solr.StrField" omitNorms="true"/>
      <!-- *** This fieldType is used by Sunspot! *** -->
      <fieldType name="tdouble" class="solr.TrieDoubleField" omitNorms="true"/>
      <!-- *** This fieldType is used by Sunspot! *** -->
      <fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
      <!-- *** This fieldType is used by Sunspot! *** -->

      <fieldType name="text" class="solr.TextField" omitNorms="false">
        <analyzer>
          <tokenizer class="solr.PatternTokenizerFactory" pattern="[\s,\.;]+"/>
          <filter class="solr.StandardFilterFactory"/>
          <filter class="solr.LowerCaseFilterFactory"/>
          <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
          <charFilter class="solr.HTMLStripCharFilterFactory"/>
          <filter class="solr.PorterStemFilterFactory"/>
        </analyzer>
      </fieldType>

      <fieldType name="text_exact" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
          <tokenizer class="solr.KeywordTokenizerFactory"/>
          <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
        <analyzer type="query">
          <tokenizer class="solr.KeywordTokenizerFactory"/>
          <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
      </fieldType>

      <fieldType name="text_ngram" class="solr.TextField" omitNorms="false">
        <analyzer>
          <tokenizer class="solr.StandardTokenizerFactory" />
          <filter class="solr.StandardFilterFactory" />
          <filter class="solr.LowerCaseFilterFactory" />
          <!-- <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="[\d+\(\)]" replacement=""/> -->
          <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
          <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15" side="front" />
        </analyzer>
      </fieldType>

      <fieldType name="text_name" class="solr.TextField" omitNorms="false">
        <analyzer>
          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
          <filter class="solr.WordDelimiterFilterFactory" preserveOriginal="1" splitOnNumerics="1" splitOnCaseChange="1" catenateWords="1"
      catenateNumbers="1" catenateAll="1" generateWordParts="1" generateNumberParts="1" stemEnglishPossessive="1" />
        </analyzer>
      </fieldType>

      <fieldType name="text_cit" class="solr.TextField" omitNorms="false">
        <analyzer>
          <tokenizer class="solr.StandardTokenizerFactory" />
          <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="\b0+" replacement=""/>
          <filter class="solr.StandardFilterFactory" />
          <filter class="solr.LowerCaseFilterFactory" />
        </analyzer>
      </fieldType>
    </types>
0

There are 0 answers