[MarkLogic Dev General] possible snippet bug

Shannon Shiflett at virginia.edu
Thu Aug 5 11:23:16 PDT 2010


Hi Mike,
I only see one result in your example. 

Sent from my iPhone

On Aug 5, 2010, at 12:06, Michael Brown <BrownMic at ldschurch.org> wrote:

> I am experiencing some unexpected functionality when I attempt to call search:snippet()
> 
>  
> 
> The snippet returned does not always have all the text that the original did, and does not always indicate the removal of text via an ellipses. This seems to happen when some of the text is in an anchor tag.
> 
>  
> 
> Following my message is a cq script that reproduces the bug (Notice the loss of the word topic in the second result returned).
> 
>  
> 
> -Mike
> 
>  
> 
> import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";
> 
>  
> 
> let $results :=
> 
> <search:result index="1" uri="/published/foo.xml" path="fn:doc(&quot;/published/foo.xml&quot;)/webml" score="171" confidence="0.351263" fitness="0.861105" xmlns:search="http://marklogic.com/appservices/search">
> 
>   <webml type="topic" uri="/study/topics/foo" xml:lang="eng" locale="eng" status="publish">
> 
>     <block type="heading" uri="/study/topics/foo.head">
> 
>       <div class="title">Foo</div>
> 
>       <div class="subTitle"/>
> 
>       <div class="definition">
> 
>         <p>
> 
>           Foo is the first <a href="/study/topics/topic">topic</a> of discussion. we will now discuss Foo...
> 
>         </p>
> 
>       </div>
> 
>     </block>
> 
>   </webml>
> 
> </search:result>
> 
>  
> 
> let $ctsquery :=
> 
> <cts:word-query qtextref="cts:text" xmlns:cts="http://marklogic.com/cts">
> 
>   <cts:text>foo</cts:text>
> 
>   <cts:option>case-insensitive</cts:option>
> 
> </cts:word-query>
> 
>  
> 
> let $options :=
> 
> <search:transform-results apply="snippet" xmlns:search="http://marklogic.com/appservices/search">
> 
>   <search:per-match-tokens>50</search:per-match-tokens>
> 
>   <search:max-matches>10</search:max-matches>
> 
>   <search:max-snippet-chars>1000</search:max-snippet-chars>
> 
>   <search:preferred-elements>
> 
>     <search:element name="block" ns=""/>
> 
>   </search:preferred-elements>
> 
> </search:transform-results>
> 
>  
> 
> return search:snippet($results, $ctsquery, $options)
> 
> 
> 
> NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
> 
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20100805/f1e39927/attachment-0001.html 


More information about the General mailing list