Hi Abhishek,
When I test this in MarkLogic 7.0-1 with the following, it returns all
three examples:
xdmp:document-insert("/test1.xml", <x>stop</x>);
xdmp:document-insert("/test2.xml", <x>stop stop</x>);
xdmp:document-insert("/test3.xml", <x>stop stop stop</x>);
cts:search(
fn:doc(),
cts:near-query(
(cts:word-query("stop"),cts:word-query("stop")),
1,"ordered"
),
"unfiltered"
)
Note that the distance argument is a max-distance. Documents with one
occurrence will therefor always match. Or actually, it will match any
document with at least one occurrence if you do a near query for the same
term. It becomes more clear if you also look at this example, which only
returns the second doc:
xdmp:document-insert("/test1.xml", <x>stop</x>);
xdmp:document-insert("/test2.xml", <x>stop stop2</x>);
xdmp:document-insert("/test3.xml", <x>stop2 stop3 stop4</x>);
cts:search(
fn:doc(),
cts:near-query(
(cts:word-query("stop"),cts:word-query("stop2")),
1,"ordered"
),
"unfiltered"
)
Are you sure documents with multiple occurrences are excluded? Which
version of MarkLogic are you running? Have you word positions enabled?
Kind regards,
Geert
*Van:* [email protected] [mailto:
[email protected]] *Namens *Abhishek53 S
*Verzonden:* woensdag 20 november 2013 20:50
*Aan:* MarkLogic Developer Discussion
*CC:* [email protected]
*Onderwerp:* [MarkLogic Dev General] Proximity Search: Behavior with
similar terms
Hi All,
Please let me know if there is any workaround for below scenario
*Current MarkLogic Behavior: Below query returning documents where the
word “stop”[only one occurrence] is present in the document*
cts:search(
fn:doc(),
cts:near-query(
(cts:word-query("stop"),cts:word-query("stop")),
1,"ordered"
),
"unfiltered"
)
*Expected Behavior: Return documents where “stop stop”[two terms adjacent
to each other] phrase is present*
Please advise.
Abhishek Srivastav
Tata Consultancy Services
Cell:- 609-865-1885
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general