Hi Judy,
Ambikas suggestion answers your question, but there might be more at hand here.
There is a difference between the cts:element-value-match call from Ambika, and
your cts:search call. You use collection('topics')/legal-topic as searchable
path. That means that the element value query you are using looks for any name
element that matches the criteria. If any matches, the whole legal-topic (with
all name descendants, whether or not they match) being returned. The
cts:element-value-match function is explicitly constraint to individual name
elements..
I am not sure legal-topic allows multiple name descendants, but if so, that
could explain why the cts:search returns too much values..
Kind regards,
Geert
Van: [email protected]
[mailto:[email protected]] Namens ambika arumugam
Verzonden: dinsdag 1 maart 2011 14:56
Aan: General MarkLogic Developer Discussion
Onderwerp: Re: [MarkLogic Dev General] Wildcard search
Note: You should also need to create lexicon for the 'name' field.
On Tue, Mar 1, 2011 at 7:23 PM, ambika arumugam
<[email protected]<mailto:[email protected]>> wrote:
Hi judie,
I hope this query solves your purpose.
cts:element-value-match(
xs:QName("name"),
"* distance)"
)
Regards
Ambika
On Tue, Mar 1, 2011 at 6:06 PM, judie pearline
<[email protected]<mailto:[email protected]>> wrote:
Hi all,
In our application we just wanted to return all the node values that ends with
distance.
let $label:="* distance"
let $search := cts:search
(
collection("topics")/legal-topic,
cts:element-value-query(
xs:QName("name"),$label,("wildcarded","case-insensitive"))
)
return $search
but the result contains
<name>Assured Distance </name>
<name>Distance Learning </name>
<name>Long Distance Services </name>
<name>Safe Distance Rule </name>
<name>long Distance Restrictions </name>
When the input is "distance *", the same query returns only the nodes that
starts with distance.
Can anyone explain me why we are not getting the desired results (Ends with
distance alone) here and whats is the modification needed to get the desired
results?
Regards,
Judy
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general