How do I restrict search results to be consistent like below:

search:search("foo") ==> returns 4 docs
search:search("bar") ==> returns 5 docs
search:search("foo OR bar") ==> returns 9 docs (assuming both terms don't appear in any single document)

How do I search for terms which have space or "/" in between terms

search:search("foo OR bar test1") ==> returns 4 docs ( search query seems to be looking for any of the terms as observed from search:parse )
search:search("foo OR bar test2") ==> returns 4 docs

Thanks,
Srini

Danny Sokolsky wrote:
How about:

search:search("foo OR bar")

To see what the cts:query would be, try:

xquery version "1.0-ml";

import module namespace search = "http://marklogic.com/appservices/search";
  at "/MarkLogic/appservices/search/search.xqy";

search:parse("foo OR bar")

-Danny


From: [email protected] 
[mailto:[email protected]] On Behalf Of Srinivas Mandadapu
Sent: Tuesday, November 17, 2009 10:24 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] search for multiple terms in ML

I mean like foo OR bar.

Below is the grammar options used for search:
 <grammar>
    <starter strength="30" apply="grouping" delimiter=")">(</starter>
    <starter strength="40" apply="prefix" element="cts:not-query">-</starter>
    <joiner strength="10" apply="infix" element="cts:or-query" 
tokenize="word">OR</joiner>
    <joiner strength="20" apply="infix" element="cts:and-query" 
tokenize="word">AND</joiner>
    <quotation>"</quotation>
    <joiner strength="50" apply="constraint">:</joiner>
  </grammar>


Andrew Welch wrote: 2009/11/17 Srinivas Mandadapu <[email protected]>: How do I search for multiple terms in ML using search lib? It seems to be
working for single term and constraints but not multiple terms though.Is
there something to be configured on ML side or additional option to be
provided for search:search API to enable the search for multiple terms?
Give an example of what you mean... do you mean something like "foo OR
bar", or "type:foo class:bar" etc..



_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to