I have a tiny database containing 4 documents with trailing wildcard search options enabled.
See Code Snippet #2 below for the data load script. Using Query Console, the following wildcard search code snippet returns a total value of 2 when it should only be 1. I'm sure that I'm missing something obvious. Hopefully another pair of eyes can spot it quickly. Code Snippet 1: Leading Wildcard Search import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; declare variable $DN := "http://demo.org/demo"; let $options := <options xmlns="http://marklogic.com/appservices/search"> <search-option>unfiltered</search-option> <return-constraints>true</return-constraints> <term> <term-option>wildcarded</term-option> </term> <constraint name="ImportedUnitCode"> <value> <element ns="http://demo.org/demo" name="ImportedUnitCode"/> </value> </constraint> <sort-order type="xs:string" collation="http://marklogic.com/collation/" direction="ascending"> <element ns="http://demo.org/demo" name="ImportedUnitCode"/> </sort-order> </options> let $q := "ImportedUnitCode:RU000*4" let $results := search:search($q, $options) return ($results/search:result//search:highlight/text(), $results) Code Snippet 2: Data Load declare variable $data := <file name="record1.xml"> <record xmlns="http://demo.org/demo"> <Id type="number">999</Id> <ImportFileId type="number">1</ImportFileId> <ImportedUnitCode type="string">RU00999</ImportedUnitCode> <ImportedAccountCode type="string">AC00002</ImportedAccountCode> <BeginningBalance type="number">0</BeginningBalance> <EndingBalance type="number">1374.63552475657</EndingBalance> </record> </file>, <file name="record2.xml"> <record xmlns="http://demo.org/demo"> <Id type="number">499</Id> <ImportFileId type="number">2</ImportFileId> <ImportedUnitCode type="string">RU00499</ImportedUnitCode> <ImportedAccountCode type="string">AC00502</ImportedAccountCode> <BeginningBalance type="number">0</BeginningBalance> <EndingBalance type="number">8524.31456955351</EndingBalance> </record> </file>, <file name="record3.xml"> <record xmlns="http://demo.org/demo"> <Id type="number">99</Id> <ImportFileId type="number">3</ImportFileId> <ImportedUnitCode type="string">RU00099</ImportedUnitCode> <ImportedAccountCode type="string">AC00902</ImportedAccountCode> <BeginningBalance type="number">0</BeginningBalance> <EndingBalance type="number">7170.55131083846</EndingBalance> </record> </file>, <file name="record4.xml"> <record xmlns="http://demo.org/demo"> <Id type="number">4</Id> <ImportFileId type="number">4</ImportFileId> <ImportedUnitCode type="string">RU00004</ImportedUnitCode> <ImportedAccountCode type="string">AC00997</ImportedAccountCode> <BeginningBalance type="number">0</BeginningBalance> <EndingBalance type="number">3041.22115626988</EndingBalance> </record> </file>; $data/xdmp:document-insert(@name, *), $data!fn:string-join((.//*:ImportedUnitCode,.//*:ImportedAccountCode,.//*:Id ), " ") Gary Russo Thomson Reuters Enterprise NoSQL Developer http://twitter.com/garyprusso
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
