Also, just to make one thing just a bit more clear. You can specify two different kinds of entries in synonym files. See http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters (solr.SynonymFilterFactory)
One is replacement, where the words before the "=>" are *replaced* by the right hand side, i.e., the words on the left hand side "disappear". This is what you are currently doing according to your original message: #Explicit mappings match any token sequence on the LHS of "=>" #and replace with all alternatives on the RHS. These types of mappings #ignore the expand parameter in the schema. #Examples: i-pod, i pod => ipod, sea biscuit, sea biscit => seabiscuit The other is equivalence, where each term is expanded into the entire list, if you do the following, with expand set to true: #Equivalent synonyms may be separated with commas and give #no explicit mapping. In this case the mapping behavior will #be taken from the expand parameter in the schema. This allows #the same synonym file to be used in different synonym handling strategies. #Examples: ipod, i-pod, i pod foozball , foosball universe , cosmos So, if instead of: allergy test => Doctors, Doctors-Medical, PHYSICIANS, Physicians & Surgeons You specified allergy test => allergy test, Doctors, Doctors-Medical, PHYSICIANS, Physicians & Surgeons Or allergy test, Doctors, Doctors-Medical, PHYSICIANS, Physicians & Surgeons with expand set to true, then you might get the behavior your desire: "Allergy test" would get indexed, along with "Doctors" and all of the rest. The difference being that in the second case, any of those terms (e.g. "Docotrs") would also get indexed as "Allergy test" which might not be what you desire, in which case the first one would do what you want. I expect that all you really need to do is: allergy test => allergy test, Doctors, Doctors-Medical, PHYSICIANS, Physicians & Surgeons to solve your problem. JRJ -----Original Message----- From: balaji [mailto:mcabal...@gmail.com] Sent: Tuesday, September 06, 2011 7:48 PM To: solr-user@lucene.apache.org Subject: Re: Synonyms Not Working when using SRC & DEST > It won't work given your current schema. To get the desired results, you > would need to expand your synonyms at both index AND query time. Right now > your schema seems to specify it only at index time. > I have a very huge schema spanning up to 10K lines , if I use query time it will be huge hit for me because one term will be mapped to multiple terms . similar in the case of allergy I doesn't want to go with comma separated as it will give some erroneous results and more over allergy and doctors are not equivalent terms to be used in comma > > So, as the other respondent indicated, currently you replace allergy with > the other list when indexing, and since allergy is not replaced during > query, it gets no hits. > I replace allergy during the index with doctors , So it shouldn't be part of the document ? Thanks Balaji -- View this message in context: http://lucene.472066.n3.nabble.com/Synonyms-Not-Working-when-using-SRC-DEST-tp3313862p3315287.html Sent from the Solr - User mailing list archive at Nabble.com.