Pradeep,

You might want to consider using the MarkLogic Search API rather than 
lib-search.  Search API is somewhat similar to lib-search, has more features 
and is more extensible, and is more actively maintained than lib-search.

search:search() will give you the URI, and the highlight hits out of the box:

import module namespace search = "http://marklogic.com/appservices/search";
    at "/MarkLogic/appservices/search/search.xqy";    
let $options := <options xmlns="http://marklogic.com/appservices/search";>
  <return-results>true</return-results>
  <return-facets>false</return-facets>
</options>
return search:search("hypothermic cardiac arrest", $options)

==>

<search:response total="6" start="1" page-length="10" 
xmlns:search="http://marklogic.com/appservices/search";>
  <search:result index="1" uri="medline/11990091" 
path="fn:doc(&quot;medline/11990091&quot;)" score="578" confidence="0.596059" 
fitness="0.83193">
    <search:snippet>
      <search:match 
path="fn:doc(&quot;medline/11990091&quot;)/MedlineCitation/Article/ArticleTitle">Serum
 potassium concentration as a predictor of resuscitation outcome in 
<search:highlight>hypothermic</search:highlight> 
<search:highlight>cardiac</search:highlight> 
<search:highlight>arrest</search:highlight>.</search:match>
    </search:snippet>
  </search:result>
  <search:result index="2" uri="medline/11986591" 
path="fn:doc(&quot;medline/11986591&quot;)" score="512" confidence="0.560997" 
fitness="0.782993">
    <search:snippet>
      <search:match 
path="fn:doc(&quot;medline/11986591&quot;)/MedlineCitation/Article/ArticleTitle"><search:highlight>Cardiac</search:highlight>
 surgery with deep <search:highlight>hypothermic</search:highlight> circulatory 
<search:highlight>arrest</search:highlight> produces less systemic inflammatory 
response than low-flow cardiopulmonary bypass in newborns.</search:match>
    </search:snippet>
  </search:result>
...  
</search:response>

You would need to use a custom snippeting function to retrieve additional nodes 
such as the document title as part of the search results.  See page 31 in the 
Search Developer's Guide 
(http://developer.marklogic.com/pubs/4.1/books/search-dev-guide.pdf) for more 
details.



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Pradeep Maddireddy
Sent: Monday, April 12, 2010 10:09 AM
To: [email protected]
Subject: [MarkLogic Dev General] Lib-Search

Hi..!


 If any of you have used the lib-search XQuery Library code available
in the marklogic developer code site, could you Please let me know  if
it is possible to get url of documents and few nodes like title, hit
highlight in the search results returned by the XQuery Library code


Thanks
Pradeep Maddireddy
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to