Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marklogic : Pagination in search:search based on eleemnt node instead of document uri

Tags:

marklogic

I have following xml format in wells.xml

<wells><well><date-created>MMDDYYYY</date-created><title>ABC</title></well><well><date-created>MMDDYYYY</date-created><title>ABC</title></well></wells>

Now I performed following search query :

declare namespace ts= "http://marklogic.com/mlu/clover/docs-xml";
import module namespace search ="http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";
declare variable $options :=<options xmlns="http://marklogic.com/appservices/search"><transform-results apply="snippet"></transform-results></options>;
for $doc in search:search("ABC",$options,1,1)//search:match 
return $doc

In result it is giving me two results set as both record in a same document wherever I passed (1,1) combination in search:search.

Please help how to resolve this issue?

Thanks in advance.

like image 944
user1660340 Avatar asked Dec 18 '25 15:12

user1660340


1 Answers

The search library, as well as all of MarkLogic's indexes are fragment/document based. So, perhaps best to split the wells document into individual well documents. But you can also easily achieve what you are looking for by adding a searchable expression. Add the following to your search options:

<searchable-expression>//well</searchable-expression>

HTH!

like image 107
grtjn Avatar answered Dec 22 '25 12:12

grtjn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!