Understandable, I think. The sample code is hard to read, and won't parse or
run in its current form. But Mary has powerful ESP.
Here's a test case that shows what I think Mary has in mind. Punctuation in the
query text could be punctuation or could be a wildcard. Since the term is
punctuation-insensitive, it is treated as a wildcard. The wildcard will be
looking for a word character, not a punctuation character, the term fails to
match anything. The second two forms show possible fixes: be explicit about no
wildcards, or be punctuation-sensitive.
(: punctuation-insensitive, implicit wildcard :)
cts:contains(
element test { "EPL and Fixtures: Are the fixtures out?" },
cts:element-value-query(
xs:QName('test'),
"EPL and Fixtures: Are the fixtures out?",
("case-insensitive",
"diacritic-sensitive",
"punctuation-insensitive",
"unstemmed",
"lang=en"))),
(: explicitly not a wildcard :)
cts:contains(
element test { "EPL and Fixtures: Are the fixtures out?" },
cts:element-value-query(
xs:QName('test'),
"EPL and Fixtures: Are the fixtures out?",
('unwildcarded',
"case-insensitive",
"diacritic-sensitive",
"punctuation-insensitive",
"unstemmed",
"lang=en"))),
(: default wildcard, punctuation-sensitive :)
cts:contains(
element test { "EPL and Fixtures: Are the fixtures out?" },
cts:element-value-query(
xs:QName('test'),
"EPL and Fixtures: Are the fixtures out?",
("case-insensitive",
"diacritic-sensitive",
"punctuation-sensitive",
"unstemmed",
"lang=en")))
=>
false
true
true
-- Mike
On 19 Jun 2012, at 07:20 , David Lee wrote:
> This is confusing to me.
> From my read of this, the "?" is in the data not the query ... so how is
> wildcarded or not affect this ?
>
> -----------------------------------------------------------------------------
> David Lee
> Lead Engineer
> MarkLogic Corporation
> [email protected]
> Phone: +1 650-287-2531
> Cell: +1 812-630-7622
> www.marklogic.com
>
> This e-mail and any accompanying attachments are confidential. The
> information is intended solely for the use of the individual to whom it is
> addressed. Any review, disclosure, copying, distribution, or use of this
> e-mail communication by others is strictly prohibited. If you are not the
> intended recipient, please notify us immediately by returning this message to
> the sender and delete all copies. Thank you for your cooperation.
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Mary Holstege
> Sent: Tuesday, June 19, 2012 10:13 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] cts:search and xdmp:save()
>
> Try adding an explicit unwilcarded option. Question mark is a wildcard
> character, so you are looking for something that matches that word with one
> more character at the end.
>
> Sent from my Samsung Epic™ 4G
>
>
> Yeshmeet Singh <[email protected]> wrote:
>
>
> Hi,
>
> I am having some trouble with the cts:search. I have an application in which
> when a user enters a search term I take that term and search it through the
> marklogic collections and return the result. Now what problem I am facing is
> that in the database in my xml file I have a tag called <head>, now if in
> this head if I have any statement that has a “?” in it it is not being
> returned by the cts:search. For example if I search for a term say “EPL and
> Fixtures” what I do first is create a cts:element-value-match query to search
> the database first and store that query in a variable which gives me the
> following output-
>
> Let $t := <v:results v:warning="non-element item"><cts:and-query>
> <cts:or-query><cts:element-value-query>
> <cts:element>_1:head</cts:element>
> <cts:text xml:lang="en">EPL and Fixtures: Are the fixtures out?</cts:text>
> <cts:option>case-insensitive</cts:option>
> <cts:option>diacritic-sensitive</cts:option>
> <cts:option>punctuation-insensitive</cts:option>
> <cts:option>unstemmed</cts:option>
> </cts:element-value-query>
> <cts:element-value-query>
> <cts:element>_1:head</cts:element>
> <cts:text xml:lang="en">Fixtures and the EPL 2009: Champion?</cts:text>
> <cts:option>case-insensitive</cts:option>
> <cts:option>diacritic-sensitive</cts:option>
> <cts:option>punctuation-insensitive</cts:option>
> <cts:option>unstemmed</cts:option>
> </cts:element-value-query>
> </cts:or-query>
> <cts:element-word-query>
> <cts:element>_1:head</cts:element>
> <cts:textxml:lang="en">EPL</cts:text>
> <cts:option>case-insensitive</cts:option>
> <cts:option>diacritic-sensitive</cts:option>
> <cts:option>punctuation-insensitive</cts:option>
> <cts:option>unstemmed</cts:option>
> </cts:element-word-query>
> <cts:or-query>
> <cts:element-word-query>
> <cts:element>_1:head</cts:element>
> <cts:textxml:lang="en">Fixtures</cts:text>
> <cts:option>case-insensitive</cts:option>
> <cts:option>diacritic-sensitive</cts:option>
> <cts:option>punctuation-insensitive</cts:option>
> <cts:option>unstemmed</cts:option>
> </cts:element-word-query>
> <cts:element-word-query>
> <cts:element>_1:head</cts:element>
> <cts:textxml:lang="en">Fixtures*</cts:text>
> <cts:option>case-insensitive</cts:option>
> <cts:option>diacritic-sensitive</cts:option>
> <cts:option>punctuation-insensitive</cts:option>
> <cts:option>unstemmed</cts:option>
> </cts:element-word-query>
> </cts:or-query>
> <cts:collection-query>
> <cts:uri>dictionaryid </cts:uri>
> </cts:collection-query>
> <cts:collection-query><cts:uri>dictionarystatus</cts:uri>
> </cts:collection-query>
> </cts:and-query>
> </v:results>
>
> Now I make a call to my cts search-
> Let result := cts:search(/wl:start, $t)
>
> The above does not return any result. And this is happening only for those
> terms in my <head> tag that have “?”.
>
> Also I wanted to write the output of my xqy file into an xml file. Using
> xdmp:save() we can create a text file. Is there any way to create an xml file?
>
> Thanks
> Yashmeet Singh
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
> for the use of the addressee(s). If you are not the intended recipient,
> please
> notify the sender by e-mail and delete the original message. Further, you are
> not
> to copy, disclose, or distribute this e-mail or its contents to any other
> person and
> any such actions are unlawful. This e-mail may contain viruses. Infosys has
> taken
> every reasonable precaution to minimize this risk, but is not liable for any
> damage
> you may sustain as a result of any virus in this e-mail. You should carry out
> your
> own virus checks before opening the e-mail or attachment. Infosys reserves
> the
> right to monitor and review the content of all messages sent to or from this
> e-mail
> address. Messages sent to or from this e-mail address may be stored on the
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
> _______________________________________________
> General mailing list
> [email protected]
> http://community.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://community.marklogic.com/mailman/listinfo/general