this expression has a bug. Attributes are multi-valued, so writing: x == "foo" doesn't work as it compares a set of values x with a single string. You first need to project the set to a single string and then you can compare this string with the given literal. Tthe only way to do this is via the join operator (which concatenates all string values to a single string -- it's arbitrary for attributes that appear multiple times, but it works fine for attributes that appear only once). This query should work: snippets?bq=[upc(text): "885909174966"]|"Apple MacBook Pro"&orderby= [x=upc(text): if exists(x) & (join(x) == "885909174966") then 1 else 0]
URL encoded form: snippets?bq=%5Bupc(text)%3A+%22885909174966%22%5D%7C%22Apple+MacBook+Pro%22&orderby=+%5Bx%3Dupc(text)%3A+if+exists(x)+%26+(join(x)+%3D%3D+%22885909174966%22)+then+1+else+0%5D All credit for the answer goes to a colleague of mine who figured out what the problem is. Alex On Fri, Jun 26, 2009 at 11:19 AM, Celebird <[email protected]> wrote: > > i believe orderby can only sort numeric values regardless > of attribute-name-and-type or custom-ranking-criteria -- > ignoring modification-time and relevancy values. > > a custom-ranking-criteria to meet your requirements > would probably need to take this into account -- e.g. > > snippets?bq=[upc:"885909174966"]|"Apple MacBook Pro"& > orderby=[x=upc(text):if join(x)=="885909174966" then 1 else 0] > > > -- Alex Dovlecel, Google Switzerland GmbH Company Identifikationsnummer: CH-020.4.028.116-1 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Base Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Base-data-API?hl=en -~----------~----~----~----~------~----~------~--~---
