By default, there is a maximum number of characters per snippet. If you hit 
that maximum, it will truncate and return fewer matches. If you want more 
matches, try increasing max-snippet-chars as well as max-matches.

Sent from my iPhone

On Sep 3, 2012, at 8:14 AM, "Abhishek53 S" 
<[email protected]<mailto:[email protected]>> wrote:


Hello All,

I am not sure what's wrong with search:snippet

I am using max-matches as 7 though it is returning at max 4 matching snippets...

Let me know in case I am missing something

ML 4.2-7 & ML 5.0-3

Code
******************

xquery version "1.0-ml";
import module namespace search = "http://marklogic.com/appservices/search";
    at "/MarkLogic/appservices/search/search.xqy";

search:snippet(
      <a>
               <div>Query terms in this div will be ignored for 
snippeting.</div>
         <div>Query terms in this div will be ignored for snippeting.</div>
         <div>Query terms in this div will be ignored for snippeting.</div>
        <div>Query terms in this div will be ignored for snippeting.</div>
        <div>Query terms in this div will be ignored for snippeting.</div>
        <div>Query terms in this div will be ignored for snippeting.</div>
        <div>Query terms in this div will be ignored for snippeting.</div>
        <div>Query terms in this div will be ignored for snippeting.</div>
     </a>,
      search:parse("terms"),
      <transform-results apply="snippet" 
xmlns="http://marklogic.com/appservices/search";>
          <max-matches>7</max-matches>
      </transform-results>
)


Output
************

<search:snippet xmlns:search="http://marklogic.com/appservices/search";>
  <search:match path="/*:html/*:body/*:div[1]">Query 
<search:highlight>terms</search:highlight> in this div will be ignored for 
snippeting.</search:match>
  <search:match path="/*:html/*:body/*:div[2]">Query 
<search:highlight>terms</search:highlight> in this div will be ignored for 
snippeting.</search:match>
  <search:match path="/*:html/*:body/*:div[3]">Query 
<search:highlight>terms</search:highlight> in this div will be ignored for 
snippeting.</search:match>
  <search:match 
path="/*:html/*:body/*:div[4]">...<search:highlight>terms</search:highlight> in 
this div will be...</search:match>
</search:snippet>

Thanks
Abhishek Srivastav
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: <mailto:[email protected]> 
[email protected]<mailto:[email protected]>
Website: http://www.tcs.com<http://www.tcs.com/>
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________

=====-----=====-----=====
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]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to