Please can any one suggest me how we can programtically make chages in the index and query part for new synonms enter.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I did something very similar. I had a list of synonyms in a table and I had to make solr take care of these synonyms both while indexing and in the query.
I wrote a python script which wrote the synonyms to a file – which is the synonyms.txt in your solr conf directory. Just make sure that the filename is linked in schema.xml as explained here – http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
Also, make sure that the text file has no “,” or spaces following and has no blank lines at the end.
Here is the snippet of my python script. Hope it helped
You need the seek and truncate to avoid preceeding “;” and empty lines.
Hope it helped