Hi Stephane,

Several people have raised the same question.  The behavior comes from 
"stepping up" to a containing element in cases where an element contains an 
exact match (works well for mixed content, but provides no benefit in this 
particular case). I agree that the inconsistency is confusing.  I'll file a bug 
to take a look and see if the behavior can be improved for this case.

--Colleen
________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Stephane Toussaint 
[[email protected]]
Sent: Thursday, July 05, 2012 3:46 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] search:search matching path coherence

Hi,

I just find something weird with the matching path returned by the search API.
Say I have this xml in my repository

<?xml version="1.0" encoding="UTF-8"?>
<ARTICLE>
<AUTHOR>
  <NAME>Toussaint</NAME>
  <FIRSTNAME>Stephane</FIRSTNAME>
</AUTHOR>
</ARTICLE>

If I request this document based on a firstname constraints the document is 
well returned, but the matching path lake of precision :

import module namespace search="http://marklogic.com/appservices/search"; at 
"/MarkLogic/appservices/search/search.xqy";

let $options := <search:options 
xmlns:search="http://marklogic.com/appservices/search";>
  <search:constraint name="firstname">
    <search:word>
      <search:element ns="" name="FIRSTNAME"/>
    </search:word>
  </search:constraint>
</search:options>
return search:search("ste*", $options)

<search:response snippet-format="snippet" total="1" start="1" page-length="10" 
xmlns="" xmlns:search="http://marklogic.com/appservices/search";>
  <search:result index="1" uri="/content/article/test.xml" 
path="fn:doc(&quot;/content/article/test.xml&quot;)" score="49152" 
confidence="0.371165" fitness="0.677309">
    <search:snippet>
      <search:match 
path="fn:doc(&quot;/content/article/test.xml&quot;)/ARTICLE/AUTHOR">
        <search:highlight>Stephane</search:highlight>
    </search:match>
    </search:snippet>
  </search:result>
[...]
</search:response>

I expect the path to return 
fn:doc(&quot;/content/article/test.xml&quot;)/ARTICLE/AUTHOR/FIRSTNAME  but in 
fact it stops on step upper.
But there is inconsistency here because if my firstname was a composed one (2 
words), then the returned base is just not the same :

<?xml version="1.0" encoding="UTF-8"?>
<ARTICLE>
<AUTHOR>
  <NAME>Toussaint</NAME>
  <FIRSTNAME>Jean Pierre</FIRSTNAME>
</AUTHOR>
</ARTICLE>

<search:response snippet-format="snippet" total="3" start="1" page-length="10" 
xmlns="" xmlns:search="http://marklogic.com/appservices/search";>
  <search:result index="1" uri="/content/article/test.xml" 
path="fn:doc(&quot;/content/article/test.xml&quot;)" score="32768" 
confidence="0.303053" fitness="0.680303">
    <search:snippet>
      <search:match 
path="fn:doc(&quot;/content/article/test.xml&quot;)/ARTICLE/AUTHOR/FIRSTNAME"><search:highlight>Jean</search:highlight>
 Pierre</search:match>
    </search:snippet>
  </search:result>
 [...]
</search:response>

Is it a bug or can someone explain me why search result print different 
information base on word count from element ?
By the way there is in fact no need of constraints to reproduce this exemple a 
simple full text search provide the very same result.

I'd like to provide a filter step based on the path information, and this issue 
did't allow me to do this.

Best Regards
Stephane

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

Reply via email to