That's a clever idea. I'll put something together and see how it turns out. Thanks for the tip.
On Wed, Jul 27, 2011 at 10:55 PM, Chris Hostetter <hossman_luc...@fucit.org>wrote: > > : With your solution, RECORD 1 does appear at the top but I think thats > just > : blind luck more than anything else because RECORD 3 shows as having the > same > : score. So what more can I do to push RECORD 1 up to the top. Ideally, I'd > : like all three records returned with RECORD 1 being the first listing. > > with omitNorms RECORD1 and RECORD3 have the same score because only the > tf() matters, and both docs contain the term "frank" exactly twice. > > the reason RECORD1 isn't scoring higher even though it contains (as you > put it "matchings 'Fred' exactly" is that from a term perspective, RECORD1 > doesn't actually match "myname:Fred" exactly, because there are in fact > other terms in that field because it's multivalued. > > one way to indicate that you (only* want documents where entire field > values to match your input (ie: RECORD1 but no other records) would be to > use a StrField instead of a TextField or an analyzer that doesn't split up > tokens (lie: something using KeywordTokenizer). that way a query on > myname:Frank would not match a document where you had indexed the value > "Frank Stalone" by a query for myname:"Frank Stalone" would. > > in your case, you don't want *only* the exact field value matches, but you > want them boosted, so you could do something like copyField "myname" into > "myname_str" and then do... > > q=+myname:Frank myname_str:"Frank"^100 > > ...in which case a match on "myname" is required, but a match on > "myname_str" will greatly increase the score. > > dismax (and edismax) are really designed for situations like this... > > defType=dismax & qf=myname & pf=myname_str^100 & q=Frank > > > > -Hoss >