: Hello Hoss!
: The case here would be: "if total result set contains any original medicines
: X, 
: then remove all generic medicines Y such that Y is a generic form of X."
: 
: In your example and in my case, the result should be Vaxidrop + Generipill

then wunder's suggestion of grouping on the family, with a group.sort that 
puts the "originals" first, is the simplest idea i can think of OOTB.  
You'll still have to look at each group and "ingnore" the generics if the 
first item in the group is an "original" -- which of course means things 
like "numFound" won't really be accurate.

An alternative solution using multiple requests wold simple be to do the 
query once with an "fq=type:original" filter, and if you get any results, 
then re-issue the query using all of the docids returned in some new 
"fq=-generic_of:(...)" filter to exclude any docs that are generics of hte 
matching originals.

That logic could also be encapsulated i na custom component -- you could 
look at the "exclude" logic QueryElevationComponent for inspiration.  the 
crux of the differnece between that while QEC gets it's excludes from a 
config file, you would get them from a (Query->DocSet)+FilterCache lookup

-Hoss

Reply via email to