: SELECT MID, AVG(Rating) as Average FROM mpr : WHERE PID in (p1[,p2,...]) : GROUP BY MID : ORDER BY Average DESC LIMIT 0, 10; : : Also I would require to boost the vales based on PIDs (some products have : more wight than others effectively computing a wighted average)
: To handle these queries I am plannig to develop a custom request handler : plugin in most generic form to be useful in general. ok .. but i'm not really sure what you're asking at this point ... as i said: the FunctionQuery code isn't relaly going to help you here .. the Faceting Code is more akin to what you are asking about. alternately: just because your database is structured arround one record for each (MID, PID, Rating) triple doesn't mean your *documents* need to be structured that way ... instead you can have one document per product and precompute the average before indexing them (that's the theory behind building an index, you precompute/denormalize/invert information for faster lookup later) -Hoss