HI. Peter, you are correct in what was missing in the search. However, you are right in being confused about the search:qtext.....
brace yourself.. Another query console gotcha... Using 'auto' formats it as html and removes the extra whitespace.. When viewed in raw format, your search:report reflects the double space and verifies your solution: Your example expanded to show search parse as well yields the following (expected) whitespace when viewed in raw format: xquery version "1.0-ml"; declare namespace host = "http://marklogic.com/xdmp/status/host"; import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; let $options := <options xmlns="http://marklogic.com/appservices/search"> <term> <term-option>case-sensitive</term-option> <term-option>diacritic-sensitive</term-option> <term-option>punctuation-sensitive</term-option> <term-option>whitespace-sensitive</term-option> <term-option>unstemmed</term-option> <term-option>unwildcarded</term-option> </term> <debug>true</debug> <search-option>filtered</search-option> </options> return ( search:search('"Hello world"',$options), search:parse('"Hello world"',$options) ) <search:response snippet-format="snippet" total="0" start="1" page-length="10" xmlns:search="http://marklogic.com/appservices/search"> <search:qtext>"Hello world"</search:qtext> <search:report id="SEARCH-FLWOR">(cts:search(fn:collection(), cts:word-query("Hello world", ("case-sensitive","diacritic-sensitive","punctuation-sensitive","whitespace-sensitive","unstemmed","unwildcarded","lang=en"), 1), ("filtered",cts:score-order("descending")), 1))[1 to 10]</search:report> <search:metrics> <search:query-resolution-time>PT0.00387S</search:query-resolution-time> <search:facet-resolution-time>PT0.00005S</search:facet-resolution-time> <search:snippet-resolution-time>PT0S</search:snippet-resolution-time> <search:total-time>PT0.018433S</search:total-time> </search:metrics> </search:response> <cts:word-query xmlns:cts="http://marklogic.com/cts"> <cts:text xml:lang="en">Hello world</cts:text> <cts:option>case-sensitive</cts:option> <cts:option>diacritic-sensitive</cts:option> <cts:option>punctuation-sensitive</cts:option> <cts:option>whitespace-sensitive</cts:option> <cts:option>unstemmed</cts:option> <cts:option>unwildcarded</cts:option> </cts:word-query> Kind Regards, David Ennis David Ennis *Content Engineer* [image: HintTech] <http://www.hinttech.com/> Mastering the value of content creative | technology | content Delftechpark 37i 2628 XJ Delft The Netherlands T: +31 88 268 25 00 M: +31 63 091 72 80 [image: http://www.hinttech.com] <http://www.hinttech.com> <https://twitter.com/HintTech> <http://www.facebook.com/HintTech> <http://www.linkedin.com/company/HintTech> On 6 January 2015 at 10:06, Peter Kester <[email protected]> wrote: > Hi Shruti, > > MarkLogic does what it is supposed to do. See below sample > > xquery version "1.0-ml"; > > xdmp:document-insert("/foo.xml", <foo>Hello world</foo>); > xdmp:document-insert("/foo2.xml", <foo>Hello world</foo>); > > xquery version "1.0-ml"; > declare namespace host = "http://marklogic.com/xdmp/status/host"; > import module namespace search = "http://marklogic.com/appservices/search" > at "/MarkLogic/appservices/search/search.xqy"; > > let $options := <options xmlns="http://marklogic.com/appservices/search"> > <term> > <term-option>case-sensitive</term-option> > <term-option>diacritic-sensitive</term-option> > <term-option>punctuation-sensitive</term-option> > <term-option>whitespace-sensitive</term-option> > <term-option>unstemmed</term-option> > <term-option>unwildcarded</term-option> > </term> > <debug>true</debug> > <search-option>filtered</search-option> > </options> > > return search:search('"Hello world"',$options) > > This will give you: > <search:response snippet-format="snippet" total="1" start="1" page-length > ="10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns=""xmlns:search=" > http://marklogic.com/appservices/search"> > <search:result index="1" uri="/foo.xml" path="fn:doc("/foo.xml")" score=" > 47104" confidence="0.5532626" fitness="0.6769772"> > <search:snippet> > <search:match path="fn:doc("/foo.xml")/foo"> > <search:highlight> > Hello world > </search:highlight> > </search:match> > </search:snippet> > </search:result> > <search:qtext> > "Hello world" > </search:qtext> > <search:report id="SEARCH-FLWOR"> > (cts:search(fn:collection(), cts:word-query("Hello world", > ("case-sensitive","diacritic-sensitive","punctuation-sensitive","whitespace-sensitive","unstemmed","unwildcarded","lang=en"), > 1), ("filtered"), 1))[1 to 10] > </search:report> > <search:metrics> > <search:query-resolution-time> > PT0.004736S > </search:query-resolution-time> > <search:facet-resolution-time> > PT0.000051S > </search:facet-resolution-time> > <search:snippet-resolution-time> > PT0.000603S > </search:snippet-resolution-time> > <search:total-time> > PT0.021619S > </search:total-time> > </search:metrics> > </search:response> > > As you can see it returns the correct document foo.xml and not foo2.xml. > The difference is that you also need to specify unfiltered in the options > section. > I’m not sure why the double spaces are not reflected in the search:qtext > or the cts:word-query in the search:report. > > Hope this helps. > > Peter > > > *Peter Kester* > Senior Consultant > [email protected] > > +31 611188543 > > http://nl.linkedin.com/in/peetkes/ > > [image: Description: Description: cid:[email protected]] > > [image: Description: Description: MarkLogic Corporation] > Graadt van Roggenweg, 328-334, 3531 AH Utrecht > http://www.marklogic.com/ > > New generation databases, you just need to think differently www. > nosqlfordummies.com <http://t.co/YKkJ0Wxseo> > > > >
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
