Thanks Geert,
In my query i have displayed only teh name element in results. Here the problem
is i just wanted to get the list all the names that ends with distance. When i
use "* distance", the results contains element values that doent ends with
distance but has "distance".
xquery version "1.0-ml";
let $node := <my-node>correspondence - Long Distance education</my-node>
return (
cts:contains($node,
cts:element-value-query(xs:QName('my-node'),"* distance", "wildcarded"))
)
<v:results v:warning="non-element item"
xmlns:v="com.marklogic.developer.cq.view">true</v:results>
Can anyone explain me the result for this query?
Regards,
judy
--- On Tue, 1/3/11, Geert Josten <[email protected]> wrote:
From: Geert Josten <[email protected]>
Subject: Re: [MarkLogic Dev General] Wildcard search
To: "General MarkLogic Developer Discussion" <[email protected]>
Date: Tuesday, 1 March, 2011, 8:51 PM
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]>
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]> 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]
http://developer.marklogic.com/mailman/listinfo/general
-----Inline Attachment Follows-----
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general