Hi Rob, Thanks for help, I tried debug options its gives me overview of what kind of queries are getting created, But still I am wondering why above query works fine when i pass 'book:(test-field:(Computer))' but does not work when I search for 'book:(test-field:(Fantasy))'
I tried same query with multiple files and my observation is it works fine only if given value is present in first element. In above case value "Computer" is present in first book element and "Fantasy" is present in second book element. On Thu, Feb 11, 2016 at 6:53 PM, Rob Szkutak <[email protected]> wrote: > Try adding <debug>true</debug> to your options and taking a look at the > cts:search() expression that's being generated. That should give you some > clues. > > Best, > Rob > > Rob Szkutak > Senior Consultant > MarkLogic Corporation > [email protected] > www.marklogic.com > > ------------------------------ > *From:* [email protected] [ > [email protected]] on behalf of Jaydip Rananavare [ > [email protected]] > *Sent:* Thursday, February 11, 2016 5:57 AM > *To:* MarkLogic Developer Discussion > *Subject:* [MarkLogic Dev General] Issue with field range and field value > indexes > > Hi All, > > We are facing an issue with field value searches in below query, > example *document is* > > <catalog> > <*book* id="bk101"> > <author>Gambardella, Matthew</author> > <title>XML Developer's Guide</title> > <genre>*Computer*</genre> > <price>44.95</price> > <publish_date>2000-10-01</publish_date> > <description>An in-depth look at creating applications > with XML.</description> > </*book*> > <*book* id="bk102"> > <author>Ralls, Kim</author> > <title>*Midnight Rain*</title> > <genre>Fantasy</genre> > <price>5.95</price> > <publish_date>2000-12-16</publish_date> > <description>A former architect battles corporate zombies, > an evil sorceress, and her own childhood to become queen > of the world.</description> > </*book*> > </catalog> > ---------------- > *query is* > > xquery version "1.0-ml"; > declare namespace html = "http://www.w3.org/1999/xhtml"; > import module namespace search = "http://marklogic.com/appservices/search" > at "/MarkLogic/appservices/search/search.xqy"; > let $options := <options xmlns="http://marklogic.com/appservices/search"> > <search-option>unfiltered</search-option> > <return-results>true</return-results> > <return-query>true</return-query> > <return-facets>false</return-facets> > <constraint name="book"> > <container> > <element name="book" ns="" /> > </container> > </constraint> > <constraint name="test-field-2"> > <range type="xs:string" collation=" > http://marklogic.com/collation/en/S1"> > <field name="test-field-2"/> > </range> > </constraint> > <constraint name="test-field"> > <*value*> > <field name="test-field"/> > </*value*> > </constraint> > <constraint name="author"> > <range type="xs:string" collation=" > http://marklogic.com/collation/en/S1"> > <path-index>/catalog/book/author</path-index> > </range> > </constraint> > </options> > let $term := 'book:(test-field:(Midnight Rain))' > let $query := cts:query(search:parse($term, $options)) > return search:resolve(<x>{$query}</x>/node(), $options) > ----------------- > > where test-field is path field with */catalog/book/title* and > */catalog/book/genre > *paths and field value searches and positions are enabled > > when we combined field-value search with element query as above query it > does not give results when we search for value that belongs to second book > tag i.e "*Midnight Rain*" > but when we search for *Computer *it gives us one result > > same query works for both terms when we do word searches on field > > Any help appreciated ! > > -- > > Thanks and regards, > > *Jaydip Rananavare* > > *M *+91 98 60 07 39 90 > > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > > -- Thanks and regards, *Jaydip Rananavare* *M *+91 98 60 07 39 90
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
