Hi Mihir,

It looks like you have a flaw in your searchable path. You write:

/a[//Subject/@Type="Primary"]

But I expect you meant:

/a[.//Subject/@Type="Primary"]

(Note the extra dot in front of the //..)

If Subject is always a direct child of element a, then you might better leave 
out the // altogether..

Kind regards,
Geert

Van: [email protected] 
[mailto:[email protected]] Namens Mihir Das
Verzonden: maandag 28 februari 2011 13:09
Aan: [email protected]
Onderwerp: [MarkLogic Dev General] cts:search abnormal behavior

Hi All,

I have wrote the query to get all the Subject starting from "P" where subject, 
type attribute is "Primary".i.e only that subject node whose value starts with 
"P"

cts:search(/a[//Subject/@Type="Primary"],cts:and-query((cts:element-query(fn:expanded-QName("",
 "Subject"),"p*"),cts:element-attribute-word-query(fn:expanded-QName("", 
"Subject"), fn:expanded-QName("", "Type"), "Primary", ("unstemmed")))))//Subject

but it is returning all the two document.Ideally it should not return me any 
document.

<a>
<Subject Type="Primary">Genetics and Genomics</Subject>
<Subject Priority="1" Type="Secondary">Public Health and Epidemiology</Subject>
</a>
-------

<a>
<Subject Type="Primary">Botany</Subject>
<Subject Priority="1" Type="Secondary">Evolution</Subject>
<Subject Priority="2" Type="Secondary">Genetics/Genomics/Gene Therapy</Subject>
<Subject Priority="3" Type="Secondary">Plant Science</Subject>
</a>

Please suggest how to achive that?
Thanks in advance.
Mihir
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to