> Consider a db of just names. Now if I > use synonym expansion at query time, I > get a set of results. > (Background: I created a class, which resets idf, tf, .. > .all to 1) since > they dont matter to me anymore. What really matters is, how > closely does the > query match to the given name. > > Currently I am getting all results with the same score > (makes sense since I > reset all the factors to 1), but how do I rank now depending > on the > closeness of match. > > P.S: the query is being exapanded at query time to match all > the documents > from the synonyms. I want to make sure that if I enterĀ > "Raj" , i get Raj as > the topmost results and the synonyms like "Raju" to be after > that.
Generally people create an additional field (populated via copyField) without synonym expansion. Lets call it name_exact. Your old field with synonym expansion is name_expanded. Search on these two fields at the same time, using higher boost on name_exact. q=name_exact:Raj^100 name_synonym:Raj^1