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