field-value-query returning unexpected results when used with 'unfiltered' search in MarkLogic -


i getting false results field-value-query when used 'unfiltered' search.

i explain problem sample data given below.

xml:

<book>     <name>dixit</name>     <age>25</age>     <entry>         <isbn>             <type>hbk</type>             <value>1234567</value>         </isbn>         <isbn>             <type>pbk</type>             <value>111111</value>         </isbn>     </entry>     <entry>         <isbn>             <type>hbk</type>             <value>1234567</value>         </isbn>         <isbn>             <type>pbk</type>             <value>222222</value>         </isbn>     </entry> </book> 

above xml can have multiple <entry> elements. 2 or more <entry> can't have same <type>.

i want entries having combination of 1 or more isbn type, values.

as in above example. want <entry> having both hbk:1234567 , pbk:111111

to achieve running below cts:query

cts:search(   fn:doc()/book//entry,   cts:and-query((     cts:field-value-query("hbk", "1234567", ("case-insensitive")),     cts:field-value-query("pbk", "222222", ("case-insensitive"))   )),   "unfiltered" ) 

output:

<entry>     <isbn>         <type>hbk</type>         <value>1234567</value>     </isbn>     <isbn>         <type>pbk</type>         <value>111111</value>     </isbn> </entry> 

according me the above output wrong should return below <entry>.

<entry>     <isbn>         <type>hbk</type>         <value>1234567</value>     </isbn>     <isbn>         <type>pbk</type>         <value>222222</value>     </isbn> </entry> 

even if running cts query 1 field-value-query given below, getting same result (entry having pbk value 111111)

cts:search(   fn:doc()/book//entry,     cts:field-value-query("pbk", "222222", ("case-insensitive")),   "unfiltered" ) 

fields have created:

pbk : /book/entry/isbn[./type = 'pbk']/value

hbk : /book/entry/isbn[./type = 'hbk']/value

index settings: (same both fields)

enter image description here

note: filtered search working fine.

please me understand why unexpected behaviour , can correct it.

tried:

cts:search(   fn:doc()/book//entry,   cts:element-query(     fn:qname('','isbn'),     cts:and-query((       cts:field-value-query("hbk", "1234567", ("case-insensitive")),       cts:field-value-query("pbk", "222222", ("case-insensitive"))     ))   ),   "unfiltered" ) 

wrap cts:and-query cts:element-query() on isbn element. below approximation of mean:

cts:search(   fn:doc()/book//entry,   cts:element-query(xs:qname("isbn"),        cts:and-query((         cts:element-value-query(xs:qname("hbk"), "1234567", ("case-insensitive")),         cts:element-value-query(xs:qname("pbk"), "222222", ("case-insensitive"))       ))    ),   "unfiltered" )  

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -