[MarkLogic Dev General] possible snippet bug

Michael Brown BrownMic at ldschurch.org
Thu Aug 5 11:54:41 PDT 2010


Sorry, I typed result when I meant search:match (I assumed that everyone would run the cq script and look at the results that running the script gives.)

Here is element that I am talking about:

  <search:match path="/search:result/webml/block/div[3]/p">
          <search:highlight>Foo</search:highlight> is the first   of discussion. we will now discuss <search:highlight>Foo</search:highlight>...
  </search:match>


From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Shannon
Sent: Thursday, August 05, 2010 12:23 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] possible snippet bug

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<mailto: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<mailto: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/0f7118c0/attachment.html 


More information about the General mailing list