Hi Erik, Brilliant you were bang on !! The indexes that I had added were on element positions and word positions which dont help here. We needed the position indexes on the path range indexes. After setting these up it works like a charm :)
Super thanks for the help !! Late Friday here but this makes my weekend even better now !! On Fri, Jul 24, 2015 at 9:26 PM, Erik Hennum <[email protected]> wrote: > Hi, Basavaraj: > > The element word, value, and range positions are all configured > separately. Since you're using element range queries, you would have to > turn on element range value positions (which are configured on the same > form that creates the element range index). > > >From your answer, it sounds like you turned on element word positions, > but maybe I'm misreading. > > > Erik Hennum > > ------------------------------ > *From:* [email protected] [ > [email protected]] on behalf of Basavaraj Kalloli [ > [email protected]] > *Sent:* Friday, July 24, 2015 8:13 AM > *To:* MarkLogic Developer Discussion > *Subject:* Re: [MarkLogic Dev General] False positives with element-query > > Hi Erik > > Yeap we did try the position indexes for element and word positions but > that still doesn't solve it. I believe Marklogic doesn't have any > hierarchical indexes as in indexes for values located within the same > element. > On Jul 24, 2015 6:04 PM, "Erik Hennum" <[email protected]> wrote: > >> 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 >> >> > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
