Thank you Erik, I was afraid we might have to add a range index for this to work. I appreciate the speedy and thorough response.
Regards, Zach From: [email protected] [mailto:[email protected]] On Behalf Of Erik Hennum Sent: Friday, January 04, 2013 12:31 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Using LT & GT Operators in search:search to compare numerical values Hi, Zach: Yes, you can use numeric and other typed values with string or structured search. The steps: 1. Create a range index on the element with the appropriate datatype. 2. Create a range constraint in the query options that names the range index. 3. Express the comparison in string or structured search. For instance, assuming an xs:int range index on an <val> element in the documents containing some values greater than 3: let $options := <options xmlns="http://marklogic.com/appservices/search"> <constraint name="val"> <range type="xs:int" facet="false"> <element ns="" name="val"/> </range> </constraint> </options> return search:search('val GT 3', $options) Range indexes and constraints are also important for sorting and facet aggregation. The documentation has more detail: http://docs.marklogic.com/guide/search-dev/search-api#id_68918 http://docs.marklogic.com/search:search#opt-constraint Hoping that helps, Erik Hennum ________________________________ From: [email protected]<mailto:[email protected]> [[email protected]] on behalf of Dunlap, Zachariah [[email protected]] Sent: Friday, January 04, 2013 8:54 AM To: [email protected]<mailto:[email protected]> Subject: [MarkLogic Dev General] Using LT & GT Operators in search:search to compare numerical values Is it possible to use the built in LT (less than) & GT (greater than) operators in Search with numerical values? These built in operators seem to expect strings as noted here: http://docs.marklogic.com/guide/search-dev/search-api#id_44520 Is there a way we can tell MarkLogic that the values for a particular set of fields are numbers not strings? Thank you, Zach The information contained in this communication is intended for the use of the designated recipients named above. If the reader of this communication is not the intended recipient, you are hereby notified that you have received this communication in error, and that any review, dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify The Associated Press immediately by telephone at +1-212-621-1898 and delete this email. Thank you. [IP_US_DISC] msk dccc60c6d2c3a6438f0cf467d9a4938
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
