solrporter-stemmer

PorterStemFilterFactory does not return results


I'm doing a project with solr and I have some problems with the PorterStemFilterFactory. When I write a query like Acquisitions, it doesn't return anything whereas in baseline (No pretreatments) I have 985 results. Normally I should have more results so I don't really understand. Can someone help me :) ?

Here is my code for the schema.xml :

 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
        <!-- in this example, we will only use synonyms at query time
        <filter class="solr.SynonymGraphFilterFactory" synonyms="wn_s.pl" format="wordnet" ignoreCase="true" expand="false"/>
        <filter class="solr.FlattenGraphFilterFactory"/>
        -->
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
        <filter class="solr.LowerCaseFilterFactory"/>
       <!--<filter class="solr.KStemFilterFactory"/>-->
        <!--<filter class="solr.SynonymGraphFilterFactory" synonyms="wn_s.pl" format="wordnet" ignoreCase="true" expand="true"/>-->
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
    </fieldType>

I don't understand if my collection is not stemmed or if it concerns my queries. I think it worked the first time bu when I restarted, it stopped working. PS : I reindexed before changing the schema so it's not that.

Sorry for my English it is not my first language.


Solution

  • I put "string" on the type for my fields in the schema.xml could it be the problem ?

    Yes, that's very likely the problem.

    String fields are stored without any transformations, so if you stored "The Acquisitions" you must search exactly for "The Acquisitions".

    Text fields (like text_general in your example) on the other hand go through a series of transformations at index and query time. Those transformations are what's described in your XML.

    In your case you'll need to (1) store the value that you want to query in a text_general field (say for example myfield_t which by default maps to a text_general field) and (2) then run a query by that field:

    q=my_field_t:acquisitions