We have a requirement to do keyword search on a set of documents returned by 
some function. For example the function getRelatedDocUrls() return a list of 
document URLs (could be hundreds of thousands of document). I need to do a 
keyword search within those documents and return the correct total count and 
return result with 10 documents per page. What is the most efficient way to do 
that?

One option I am thinking is to do the keyword search first then join the result 
with the set of documents, e.g.

Let $urls := getRelatedDocUrls()
for $result in search:search(keyword)/search:result, $url in $urls
where $result/@uri = $url

There are two problems

1.      search:search(keyword) return one page at a time. Suppose I make it 
return 20 docs per page, then the first page may not have any document matching 
$urls.

2.      search:search(keyword) return the total count of document matching 
keyword. However I want the total count of documents not only matching the 
keyword, but also with url in $urls

Of course I can make search:search(keyword) to return all result in one page 
and then through the join to find out the answer above. However this will be 
very inefficient because search:search(keyword) can return millions of 
documents. I just want the correct total count and the first 10 documents that 
match the keyword and with url match $urls.

What is the most efficient way to do this?

Thanks



Ningjun Wang
Consulting Software Engineer

LexisNexis Global Solutions Dev
New Providence, NJ
(908) 665-6787

_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to