Hi Anshu,
Another thing you can try is to add "exact" term-options to your value
constraint. This worked for me in 4.2-4:
xquery version "1.0-ml";
xdmp:document-insert("/test1.xml",
<foo>
<title xmlns="http://xyz">Reviews of Physiology, Biochemistry</title>
</foo>);
xdmp:document-insert("/test2.xml",
<foo>
<title xmlns="http://xyz">Reviews of Physiology Biochemistry</title>
</foo>);
import module namespace search = "http://marklogic.com/appservices/search"
at "/MarkLogic/appservices/search/search.xqy";
search:search('title:(Reviews of Physiology, Biochemistry)',
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="title">
<value>
<element ns="http://xyz" name="title"/>
<term-option>exact</term-option>
</value>
</constraint>
<search-option>unfiltered</search-option>
<debug>true</debug>
</options>,
1,
5
)
=>
<search:response total="1" start="1" page-length="5" xmlns=""
xmlns:search="http://marklogic.com/appservices/search">
<search:result index="1" uri="/test1.xml"
path="fn:doc("/test1.xml")" score="184" confidence="0.599496"
fitness="0.668156">
<search:snippet>
<search:match
path="fn:doc("/test1.xml")/foo/*:title"><search:highlight>Reviews of
Physiology, Biochemistry</search:highlight></search:match>
</search:snippet>
</search:result>
<search:qtext>title:(Reviews of Physiology, Biochemistry)</search:qtext>
<search:report id="SEARCH-FLWOR">(cts:search(fn:collection(),
cts:element-value-query(fn:QName("http://xyz", "title"), "Reviews of
Physiology, Biochemistry",
("case-sensitive","diacritic-sensitive","punctuation-sensitive","whitespace-sensitive","unstemmed","unwildcarded","lang=en"),
1), ("unfiltered"), 1))[1 to 5]</search:report>
<search:metrics>
<search:query-resolution-time>PT0.047S</search:query-resolution-time>
<search:facet-resolution-time>PT0S</search:facet-resolution-time>
<search:snippet-resolution-time>PT0S</search:snippet-resolution-time>
<search:total-time>PT0.047S</search:total-time>
</search:metrics>
</search:response>
-Danny
From: [email protected]
[mailto:[email protected]] On Behalf Of Damon Feldman
Sent: Thursday, June 23, 2011 5:59 AM
To: General MarkLogic Developer Discussion
Subject: [BULK] Re: [MarkLogic Dev General] [BULK] Re: String range index
contains duplicate values
Importance: Low
Anshu,
I think a key difference is that your cts:search() does not specify the
"unfiltered" option but your search:search() call does. If you refer to the
documentation at
http://docs.marklogic.com/4.2doc/docapp.xqy#display.xqy?fname=http://pubs/4.2doc/xml/performance/unfiltered.xml
you'll see that the "unfiltered" option tells the server to skip the filtering
step and sometimes return additional documents.
Yours,
Damon
________________________________
From: [email protected]
[[email protected]] On Behalf Of Anshu Raheja
[[email protected]]
Sent: Thursday, June 23, 2011 4:13 AM
To: General MarkLogic Developer Discussion
Subject: [BULK] Re: [MarkLogic Dev General] String range index contains
duplicate values
Hi Greet,
Following query i tried to verify cts:element-value-query behaviour :
cts:search(/record,cts:element-value-query(xs:QName('xyz:title'),'Reviews of
Physiology, Biochemistry'))
Resultset of this query contains only those documents which have title element
with value Reviews of Physiology, Biochemistry.
Documents in the database contain single title element.
Thanks,
Anshu
On 23/06/2011 08:41, Geert Josten wrote:
Hi Anshu,
Can you also show the code of using cts:element-value-query directly?
Do documents in the database contain multiple titles, or always just one?
Kind regards,
Geert
Van: Anshu Raheja [mailto:[email protected]]
Verzonden: donderdag 23 juni 2011 9:17
Aan: General MarkLogic Developer Discussion
CC: Geert Josten
Onderwerp: Re: [MarkLogic Dev General] String range index contains duplicate
values
Hi Greet,
Please find the code below:
search:search('title:(Reviews<UrlBlockedError.aspx> of Physiology,
Biochemistry)',
<options
xmlns="http://marklogic.com/appservices/search"<http://marklogic.com/appservices/search>>
<constraint name="title">
<value>
<element ns="http://xyz"<http://xyz> name="title"/>
</value>
</constraint>
<search-option>unfiltered</search-option>
</options>,
1,
5
)
Output of the above query should return documents which contains element title
with value 'Reviews of Physiology, Biochemistry'. However, it returns doucments
which include title element with following value Reviews of Physiology,
Biochemistry' and 'Reviews of Physiology Biochemistry'.
Let me know in case you need more info.
Thanks,
Anshu
On 23/06/2011 06:07, Geert Josten wrote:
Hi Anshu,
Could you show us the code you are using?
Kind regards,
Geert
Van:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] Namens Anshu Raheja
Verzonden: donderdag 23 juni 2011 4:17
Aan: General MarkLogic Developer Discussion
CC: Steve Mallen
Onderwerp: Re: [MarkLogic Dev General] String range index contains duplicate
values
Hi All,
Can someone please shred somelight on what am i missing in the below mention
query and receiving duplicate values or getting title as result which doesn't
have , in it however i search for a title which has , present in it.
Thanks,
Anshu
On 22/06/2011 17:01, Anshu Raheja wrote:
Hi All,
I am facing similar issue of duplicate values while trying to execute
element-value-query. i am using following to create element-value-query in
search:search<UrlBlockedError.aspx> :
<constraint name="title">
<value>
<element ns="http://xyz"<http://xyz> name="title"/>
</value>
</constraint>
ho
I am searching for following text as title : "Reviews of Physiology,
Biochemistry".
The result contains items with , and without , in the search term, e.g:
"Reviews of Physiology Biochemistry"
"Reviews of Physiology, Biochemistry"
I have tried the same search with cts:element-value-query and that works
perfectly fine and gives the results for the exact string value passed(either
with , or without ,) as title.
I also tried to resolve this with changing string range index root collation to
unicode collation but didn't get any joy.
Please Advice!
Thanks,
Anshu
On 06/06/2011 17:33, Steve Mallen wrote:
Hi Jason,
Initially I did do a comparison of the actual codepoints in the two
output strings, because my first suspicion was that they *must* be
subtly different somehow.
Unfortunately, I no longer have the output for that query (and I've
changed the index so it uses "Unicode Codepoint"), so I can't share the
exact codepoints any more but I can assure you they were identical :)
Cheers,
-Steve
On 06/06/2011 17:02, Jason Hunter wrote:
I'm curious what string-to-codepoints() shows for those two strings. Are they
really the same codepoints?
Sent from my iPhone
On Jun 6, 2011, at 2:19 AM, Steve
Mallen<[email protected]><mailto:[email protected]> wrote:
Hi Ron,
Yes, it behaves exactly the same. I've also tried using the explicit
option "item-order" and adding a matching default collation to the
prolog of the query.
What's interesting is that doing a cts:frequency() on the two "Pia,
H.W." values gives different numbers when doing the frequency lookup as
part of the same query (e.g. in a FLOWR). However, when searching for
the matching documents by string value in an XPath I only get one of the
frequencies. It is as if one of the values in the list is completey
bogus. I am confused :(
-Steve
On 06/06/2011 09:52, Ron Hitchens wrote:
Does it behave the same way with an explicit collation
option on the call to cts:element-attribute-values that
matches the one in the range index definition?
http://developer.marklogic.com/pubs/4.2/apidocs/Lexicons.html#cts:element-attribute-values
On Jun 6, 2011, at 9:29 AM, Steve Mallen wrote:
Hi folks,
I have another mystery for the lexicon experts :)
I've been fetching values out of a string attribute range index in item
order and processing them a batch at a time. But I have noticed that
occasionally I get duplicate values out of the index. This is causing
conflicting updates (since I use the URI-encoded name as the basis for
document URIs and insert many documents per query).
I would have expected the cts:element-attribute-values() to return a
list of unique string values - I don't really want to have to do
fn:distinct-values() over them, and wouldn't have thought this necessary.
I have checked the exact character strings returned by the function and
they are identical - I checked this by doing a string-to-codepoints() on
the suspect values. Here is an example of what I'm calling and getting
back from the server:
cts:element-attribute-values(xs:QName('lexi'),
xs:QName('formatted_name'), "Pia, H.", ("limit=50"))
Pia, H. W.
Pia, Hans Werner
Piacente, V.
Piacente, Vincenzo
Piacenti, Marcello
Piacentini-Sorbi, Sylvia
Piacentini, A.
Piacentini, Dario
Piacentini, Giuseppe
Piacentini, I.
Piacentini, John C.
Piacentini, Leonardo
Piacentini, Lucia
Piacentini, M.
Piacentini, Mauro
Piacentini, Paola
Piacentino, Filippo
Piacentino, G.
Piacere, A
Piačková, Veronika
Piacquadio, A. M.
Piacquadio, Piera
Piaditis, George
Piaget, A.
Piaget, Gerald W.
Piaget, Jean
Piaggesi, A.
Piaggi, GianCarlo
Piaggi, Stefania
Piaggio, G.
Piaggio, Gilda
Piaggio, Maurizio
Piagnani, C.
Piagnani, Maria Claudia
Piagnerelli, M
Piagnerelli, M.
Piagnerelli, Michael
Piaia, F.
Piaia, Rosamari
Piálek, Jaroslav
Piall, E. M.
Pialot, Olivier
Pialoux, G.
Pialoux, Vincent
Pia, F.
Pia, H. W.
Pia, Hans Werner
Pia, Julius
Pia, M. G.
Pia, S.
Notice that "Pia, H.W." is returned from the top of the list and also
near the bottom. Now this suggests to me that either:
a) There is only one value in the index and the function call is
returning it twice in different locations.
or
b) There are actually two values in the index, but they are somehow
being normalised and returned as the same string value.
I am using the "Root Collation" for the range index. Could that be the
issue? This seems like it may be a bug to me, but perhaps I'm doing
something silly.
Many thanks for your thoughts,
-Steve
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
---
Ron Hitchens {mailto:[email protected]} Ronsoft Technologies
+44 7879 358 212 (voice) http://www.ronsoft.com
+1 707 924 3878 (fax) Bit Twiddling At Its Finest
"No amount of belief establishes any fact." -Unknown
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
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