Hi Dom, I think Doug is right. There is an interesting comment on this between the user notes on that function, see the last paragraph:
http://developer.marklogic.com/pubs/4.1/apidocs/cts-query.html#cts:element-value-query The fourth example might also be of interest. In fact, extrapolating from the example confirms Doug's suggestion: for $node in (<my-node>1398</my-node>, <my-node>139/xxx</my-node>, <my-node>8139</my-node>, <my-node>xxx/139</my-node>) return cts:contains($node, cts:element-value-query(xs:QName('my-node'), "139* *", "wildcarded")) (: => true true false false :) Kind regards, Geert > drs. G.P.H. (Geert) Josten Consultant Daidalos BV Hoekeindsehof 1-4 2665 JZ Bleiswijk T +31 (0)10 850 1200 F +31 (0)10 850 1199 mailto:[email protected] http://www.daidalos.nl/ KvK 27164984 P Please consider the environment before printing this mail. De informatie - verzonden in of met dit e-mailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Glidden, Douglass A > Sent: dinsdag 9 februari 2010 19:27 > 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
