0

I am learning solr and using solr-5.3.0. I want to include common stemmers in solr. I followed this Tutorial. But after making changes to the schema.xml when I search for a term I didn't get desired output. ALso, there are many schema.xml and I am not sure which one to edit.

{
"responseHeader": {
    "status": 0,
    "QTime": 1,
    "params": {
        "indent": "true",
        "q": "HOLIDAY",
        "_": "1441115332479",
        "wt": "json"
    }
},
"response": {
    "numFound": 2,
    "start": 0,
    "docs": [
        {
            "id": "1234",
            "name": [
                "A lovely winter holiday"
            ],
            "_version_": 1511117845476409300
        },
        {
            "id": "1235",
            "name": [
                "A lovely summer holiday"
            ],
            "_version_": 1511118023312801800
        }
    ]
  }
}

when I search for holidays it didn't give any result. I added this in schema.xml.

<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.StandardTokenizerFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
YoungHobbit
  • 13,254
  • 9
  • 50
  • 73
user4974500
  • 139
  • 1
  • 2
  • 12

1 Answers1

0

try with below fieldType ....

<fieldType name="text" class="solr.TextField" omitNorms="false">
    <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.StandardTokenizerFactory"/>
    </analyzer>
    </fieldType>
Abhijit Bashetti
  • 8,518
  • 7
  • 35
  • 47
  • I need to edit these changes in the schema.xml ? But, there are many schema.xml files.Also, while creating core when i try to give a different name for schema.xml , nothing gets created. – user4974500 Sep 01 '15 at 14:03
  • no I dont think so you need to do any change in your schema file...I thought your fieldType is not correct. so I removed "PorterStemFilterFactory". But I tried with PorterStemFilterFactory in solr analysis tool and it seems fieldType is fine. My question is did you used the solr analysis tool? – Abhijit Bashetti Sep 01 '15 at 14:05
  • No , i didn't use solr analysis tool. I am querying from the `Query` – user4974500 Sep 01 '15 at 14:07
  • PorterStemFilterFactory helps to to removes common endings from words...example lovely to love.... and you have used the same in index and query. So I dont see there is any issue – Abhijit Bashetti Sep 01 '15 at 14:08
  • try the analysis tool by accessing http://localhost:8983/solr...if you have core created http://localhost:8983/solr/core_name – Abhijit Bashetti Sep 01 '15 at 14:10
  • In Analyse Fieldname / FieldType there is no entry of type : `text` , which i added in the schema.xml. – user4974500 Sep 01 '15 at 14:10
  • did you see text_en" fieldType... have a look at this tutorail you will get basic idea ...http://yonik.com/solr-tutorial/ – Abhijit Bashetti Sep 01 '15 at 14:12
  • Yeah, Now I am searching in analysis tool,but the fieldtype name `text` is not present there. – user4974500 Sep 01 '15 at 14:13
  • i checked in types `text_en` is there. – user4974500 Sep 01 '15 at 14:15
  • ok...did you tried by adding field value for index and query...check the same – Abhijit Bashetti Sep 01 '15 at 14:17