Hi,
I've been going through the analytics tutorial at 
https://developer.marklogic.com/learn/rest/analytics. I have a custom search 
returning an average on a variable. However, what is frequently needed is to 
return the average of a variable across another variable/facet. The tutorial 
shows how to produce constraints/facets, but doesn't show how to return 
averages across the constraint/facet. I was hoping that by nesting the code, 
the appropriate average would be returned, but the server seems to just ignore 
the average request (see below). What am I doing wrong?
xdmp:document-insert("/Default/climate/rest-api/options/tutorial.xml",  
<search:options xmlns:search="http://marklogic.com/appservices/search";>     
<search:constraint name="location">    <search:range type="xs:string" 
facet="true" collation="http://marklogic.com/collation/";>      <search:element 
ns="http://data/"; name="LOCATION_ID"
      <search:values name="temperature">          <search:range type="xs:int">  
         <search:element ns="http://data/"; name="TEMPERATURE_READING"/>         
  </search:range>         <search:aggregate apply="avg"/>      </search:values>

      </search:element>     </search:range>  
</search:constraint></search:options>)
Thanks.                                           
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to