[MarkLogic Dev General] Find exact query submitted

Ryan Dew ryan.j.dew at gmail.com
Wed Mar 21 10:56:47 PDT 2012


You can use cts:stem (http://api.xqueryhacker.com/#cts:stem ).

cts:stem('ran', 'en')
=>
'run'

And you might want to look at cts:highlight.

http://api.xqueryhacker.com/#cts:highlight
"Returns a copy of the node, replacing any text matching the query with the
specified expression. You can use this function to easily highlight any
text found in a query. Unlike fn:replace and other XQuery string functions
that match literal text, cts:highlight matches every term that matches the
search, including stemmed matches or matches with different capitalization."

On Wed, Mar 21, 2012 at 7:47 AM, Shah, Mehul (LNG-NPV) <
mehul.shah at lexisnexis.com> wrote:

>  I guess I should have asked question a bit differently with original
> purpose;****
>
> ** **
>
> What we are looking for is hit highlighting in non-xml/text documents in
> its native form (like pdf, word). ****
>
> One way we were thinking is to use expanded terms for a query and
> highlight in native document ourselves; ****
>
> So we are looking for an option to return all possible term expansions for
> a query from marklogic - is it possible?****
>
> ** **
>
> Is there any other way to hit-highlight in native document?****
>
>    ****
>
> ** **
>
> FYI:****
>
> Previously I tried this:****
>
> ...<options xmlns="http://marklogic.com/appservices/search">****
>
> <term>****
>
>   <term-option>stemmed</term-option>****
>
> </term>****
>
>   <return-query>true</return-query>****
>
> </options>****
>
> return search:search("ran",$options)****
>
> ** **
>
> ** **
>
> I am expecting all possible expanded values it may be searching - e.g.
> ran, run, running...****
>
> However I get following:****
>
> ...<search:qtext>ran</search:qtext>****
>
> -****
>
> <search:query>****
>
> -****
>
> <cts:word-query qtextref="cts:text">****
>
> <cts:text>ran</cts:text>****
>
> <cts:option>stemmed</cts:option>****
>
> </cts:word-query>****
>
> </search:query>****
>
> -****
>
> <search:metrics>****
>
> ...****
>
> ** **
>
> ** **
>
> Thanks.****
>
> ** **
>
> ** **
>
> *From:* general-bounces at developer.marklogic.com [mailto:
> general-bounces at developer.marklogic.com] *On Behalf Of *Ryan Dew
> *Sent:* Tuesday, March 20, 2012 6:45 PM
> *To:* MarkLogic Developer Discussion
> *Subject:* Re: [MarkLogic Dev General] Find exact query submitted****
>
> ** **
>
> If this is for search:search you might want to add the following to your
> search options****
>
> ** **
>
> <return-query>true</return-query>
>
> -Ryan Dew****
>
> On Tue, Mar 20, 2012 at 4:37 PM, Shah, Mehul (LNG-NPV) <
> mehul.shah at lexisnexis.com> wrote:****
>
> Is there a way to see exactly how the query was expanded and submitted
> finally?
> i.e. certain terms may be eliminated, certain terms may be stemmed, or
> there may be use of synonyms -- I want to know finally what was the query
> that was searched.
>
> Can I retrieve that as part of search result?
>
> Thanks.
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general****
>
> ** **
>
> _______________________________________________
> 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/20120321/0e62dc81/attachment.html 


More information about the General mailing list