Dom,
Doug's suggestion of changing the search string to match multiple words is a
good one. For example, consider the following query:
let $x := <a>123/456/abc</a>
return
(
cts:contains($x, cts:element-value-query(xs:QName("a"), "123* *",
("wildcarded"))),
cts:contains($x, cts:element-value-query(xs:QName("a"), "123*",
("wildcarded")))
)
=> true
false
Another thing: you mentioned that you turned on all wildcard indexes. That is
probably not your best bet. I would recommend the following (assuming you are
using 4.1-3 or greater) index settings for a good balance between good wildcard
performance and database size:
stemmed searches
word searches
word positions
three character searches
three character word positions
word lexicon (unicode collation)
You can add other options as needed (such as case-sensitive and
diacritic-sensitive), but for most content sets, you should not need the 2 and
1 character searches or the trailing wildcards if you have these options
enabled.
-Danny
From: [email protected]
[mailto:[email protected]] On Behalf Of Glidden, Douglass
A
Sent: Tuesday, February 09, 2010 10:27 AM
To: [email protected]
Subject: RE: [MarkLogic Dev General] element-value-query with wildcards
Dom,
I would guess that this issue has to do with word boundaries. When you do an
element-value-query for '139*', you are searching for only elements whose
values contain a single word starting with '139' (because '*' does not match on
word boundaries), but the slashes in your desired value are probably being
interpreted as word boundaries. There are a couple of options here, I think.
One would be to change the search string in the element-value-query to '139*
*'. That should match one or more words with the first word starting with
'139'. Another option would be to keep the string the same but use an
element-word-query, but that will also return positive for values like
'890/1396/ZZ', where any "word" in the element starts with 139.
Doug Glidden
Software Engineer
The Boeing Company
[email protected]
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Dominic Beesley
Sent: Tuesday, February 09, 2010 13:09
To: [email protected]
Subject: [MarkLogic Dev General] element-value-query with wildcards
Hello,
I've been trying to get the following search working:
cts:and-query(
(
cts:element-attribute-value-query(xs:QName("xm:field"),
xs:QName("type"), "number")
, cts:element-value-query(xs:QName("xm:field"),('139*'),("wildcarded"))
)
Search for <xm:field type='number'> element containing something starting with
139. However I don't seem to be able to get this to work. It doesn't return all
the values in my data.
It brings back: "1398" but I know there is also a value "139/2004/EC" which
I'd also like it to find.
If I change this to:
cts:and-query(
(
cts:element-attribute-value-query(xs:QName("xm:field"),
xs:QName("type"), "number")
,
cts:element-value-query(xs:QName("xm:field"),('139/2004/EC'),("wildcarded"))
)
It works but I need to be able to find both at once if possible.
I've set all the wildcard options to true on the database and added a "element
word lexicon" and reindexed. Will this not work? Do I need a different type of
lexicon, range?
Any help gratefully received
Cheers
Dom
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general