Hi,

I have records as follows

<record>
<Author>
<Name>Peter</Name>
<City>NewYork</City>
</Author>
<Editor>
<Name>Steven</Name>
<City>Virginia</City>
</Editor>
</record>

<record>
<Author>
<Name>Smith</Name>
<City>Phoenix</City>
</Author>
<Editor>
<Name>Peter Jackson</Name>
<City>Washington</City>
</Editor>
</record>

My requirement is to find Author/Name starting with  "Peter*" which should
return only the first record. However the following code returns  both the
record where "Peter*" is present in Editor/Name


declare variable $mynamespace := "http://some.com/mynamespace";;
declare variable $QUERY-OPTIONS :=
(<search:term-option>wildcarded</search:term-option>,

 <search:term-option>case-insensitive</search:term-option>,

 <search:term-option>diacritic-insensitive</search:term-option>,

 <search:term-option>unstemmed</search:term-option>
                                    );

declare variable $OPTIONS := <options xmlns="
http://marklogic.com/appservices/search";>
                               <constraint name="Author">
                                 <element-query ns="{$mynamespace}"
name="Author" />
                                  {$QUERY-OPTIONS}
                              </constraint>,
                              <page-length>1000</page-length>,


 </options>;
let $query := "Author:Peter*"
let $results := search:search($query,$OPTIONS)
return $results

This is the query formed

<search:report id="SEARCH-FLWOR">(cts:search(fn:collection(),
cts:element-query(xs:QName("mynamespace:Author"), cts:word-query("Peter*",
("lang=en"), 1), ()), ("score-logtfidf"), 1))[1 to 1000]</search:report>

I found this issue only with Wildcard search in cts:element-query whereas
"Author:Peter" works perfectly. Is this a known issue or do i have to
modify my implementation.

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

Reply via email to