Hi,
one-way managed synonyms seems to work fine, but I cannot make both-way
synonyms work.
Steps to reproduce with Solr 5.4.1:
1. create a core:
$ bin/solr create_core -c test -d server/solr/configsets/basic_configs
2. edit schema.xml so fieldType text_general looks like this:
<fieldType name="text_general" class="solr.TextField"
positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.ManagedSynonymFilterFactory" managed="english"
/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
3. reload the core:
$ curl -X GET "
http://localhost:8983/solr/admin/cores?action=RELOAD&core=test"
4. add synonyms, one one-way synonym, one two-way, reload the core again:
$ curl -X PUT -H 'Content-type:application/json' --data-binary
'{"mad":["angry","upset"]}' "
http://localhost:8983/solr/test/schema/analysis/synonyms/english"
$ curl -X PUT -H 'Content-type:application/json' --data-binary
'["mb","megabytes"]' "
http://localhost:8983/solr/test/schema/analysis/synonyms/english"
$ curl -X GET "
http://localhost:8983/solr/admin/cores?action=RELOAD&core=test"
5. list the synonyms:
{
"responseHeader":{
"status":0,
"QTime":0},
"synonymMappings":{
"initArgs":{"ignoreCase":false},
"initializedOn":"2016-02-11T09:00:50.354Z",
"managedMap":{
"mad":["angry",
"upset"],
"mb":["megabytes"],
"megabytes":["mb"]}}}
6. add two documents:
$ bin/post -c test -type 'application/json' -d '[{"id" : "1", "title_t" :
"10 megabytes makes me mad" },{"id" : "2", "title_t" : "100 mb should be
sufficient" }]'
$ bin/post -c test -type 'application/json' -d '[{"id" : "2", "title_t" :
"100 mb should be sufficient" }]'
7. search for the documents:
- all these return the first document, so one-way synonyms work:
$ curl -X GET "
http://localhost:8983/solr/test/select?q=title_t:angry&indent=true"
$ curl -X GET "
http://localhost:8983/solr/test/select?q=title_t:upset&indent=true"
$ curl -X GET "
http://localhost:8983/solr/test/select?q=title_t:mad&indent=true"
- this only returns the document with "mb":
$ curl -X GET "
http://localhost:8983/solr/test/select?q=title_t:mb&indent=true"
- this only returns the document with "megabytes"
$ curl -X GET "
http://localhost:8983/solr/test/select?q=title_t:megabytes&indent=true"
Any input on how to make this work would be appreciated.
Thanks,
Bjørn