Hi, Basavaraj: The best approach if at all possible is to put each size data row in a separate document instead of putting a size data table in a document. That's a general recommendation for MarkLogic: treat a document as a row and a collection as a table. Then, the unfiltered indexes will yield the rows you want.
Did you try turning on range value positions for your range indexes? Hoping that helps, Erik Hennum ________________________________ From: [email protected] [[email protected]] on behalf of Basavaraj Kalloli [[email protected]] Sent: Friday, July 24, 2015 3:04 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] False positives with element-query Hi, We have a requirement where we need to search for min and max values which should occur within an element For eg: <SIZES> <SIZEDATA> <SIZE>12000</SIZE> <SIZE_MIN>12000</SIZE_MIN> <SIZE_MAX>12000</SIZE_MAX> </SIZEDATA> <SIZEDATA> <SIZE>3500</SIZE> <SIZE_MIN>3500</SIZE_MIN> <SIZE_MAX>3500</SIZE_MAX> </SIZEDATA> </SIZES> Given the above xml we need to search for min and max values in the range: 4000 and 5000. Now we have a element-query as: import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; let $size-min-query := cts:element-range-query(xs:QName("SIZE_MIN"), "<=", xs:double(4000), (), 0) let $size-max-query := cts:element-range-query(xs:QName("SIZE_MAX"), ">=", xs:double(5000), (), 0) let $and-query := cts:and-query(($size-min-query, $size-max-query)) let $q := cts:element-query(xs:QName("SIZEDATA"), $and-query) let $options := <options xmlns="http://marklogic.com/appservices/search"> <search-option>unfiltered</search-option> <return-results>true</return-results> </options> return search:resolve(<q>{$q}</q>/node(), $options) If we run the above query this returns the document but ideally it shouldnt because the element's i.e SIZEDATA doesnt satisfy the range. If I change the options to use filtered search this works. We tried setting up element positions and word positions to on but still we still have false positive. Any pointers or any other indexes which can help us?
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
