Hi,

I need to tokenize my search term and then do an or-query for each term. Below 
is the code I am using. But it does not give me any results. Also, If I remove 
the and query then also no results are coming.Please let me know what I am 
missing.

let $search := "Bombay Delhi"
let $options :=
<options xmlns="http://marklogic.com/appservices/search";>

    <searchable-expression
        xmlns:wl =
        "">
        //body/title
    </searchable-expression>

    <term>
        <term-option>punctuation-sensitive</term-option>
        <term-option>case-insensitive</term-option>
    </term>

    <transform-results apply="raw" />

    <return-facets>false</return-facets>
    <return-metrics>false</return-metrics>

      <additional-query>
            {
            cts:and-query((

              cts:or-query((for $token in fn:tokenize($search, " ")
                return
                 cts:element-word-query(xs:QName("title"),$token,
                                     "case-insensitive"))) ,
             cts:document-query(($Id))))

             }
        </additional-query>

</options>

let $suggestions := search:search($search,$options)
return
    $suggestions

Thanks,
Pragya
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to