On Fri, Dec 13, 2013 at 11:42 AM, Colleen Whitney < [email protected]> wrote:
> I see two problems. The constraint definition is not in the search > namespace (either add it to the root options node as the default namespace, > or add the prefix to the constraint elements). > Right. A leftover result of my poking around. :-) > Also, you have brackets inside the "". Try removing the brackets. > > In this case I case see that they aren't needed. However, they are in the examples. In cases where I want to find ONLY an entire phrase, in an element. Wouldn't I use the brackets or single quotes to do grouping? > Debug tip: turn on the debug option using > <search:debug>true<search:debug>, or use search:parse to see how your query > is being parsed. > > Great tip. Thanks. --Tim > Sent from my iPhone > > On Dec 13, 2013, at 4:39 AM, "Timothy W. Cook" <[email protected]> wrote: > > In the BBQ tutorial: > http://developer.marklogic.com/learn/2009-07-search-api-walkthrough > > The examples using constraints are a bit confusing (for me) in the exact > syntax. > For example, it doesn't explicitly say that the options need to be wrapped > in <search:options>. > > Anyway, the simple value example doesn't return any matches: > > xquery version "1.0-ml"; > import module namespace > search = "http://marklogic.com/appservices/search" > at "/MarkLogic/appservices/search/search.xqy"; > > search:search("[flavor:smoky]", > <search:options> > <constraint name="flavor"> > <value> > <element ns="http://example.com" name="flavor-descriptor"/> > </value> > </constraint> > </search:options>) > > Returns zero hits (with or without the brackets): > > <?xml version="1.0" encoding="UTF-8"?> > <search:response snippet-format="snippet" total="0" start="1" > page-length="10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" > xmlns:search="http://marklogic.com/appservices/search"> > <search:qtext>[flavor:smoky]</search:qtext> > <search:metrics> > > <search:query-resolution-time>PT0.006552S</search:query-resolution-time> > > <search:facet-resolution-time>PT0.000082S</search:facet-resolution-time> > <search:snippet-resolution-time>PT0S</search:snippet-resolution-time> > <search:total-time>PT0.006799S</search:total-time> > </search:metrics> > </search:response> > > There are three documents with "flavor-descriptor" = "smoky". > > Thanks, > Tim > > > > -- > MLHIM VIP Signup: http://goo.gl/22B0U > ============================================ > Timothy Cook, MSc +55 21 94711995 > MLHIM http://www.mlhim.org > Like Us on FB: https://www.facebook.com/mlhim2 > Circle us on G+: http://goo.gl/44EV5 > Google Scholar: http://goo.gl/MMZ1o > LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > > -- MLHIM VIP Signup: http://goo.gl/22B0U ============================================ Timothy Cook, MSc +55 21 94711995 MLHIM http://www.mlhim.org Like Us on FB: https://www.facebook.com/mlhim2 Circle us on G+: http://goo.gl/44EV5 Google Scholar: http://goo.gl/MMZ1o LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
