我的记录看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<person>
<account>
<domain>ABBVIENET</domain>
<username>TANGTJ</username>
<status>ENABLED</status>
</account>
<company>AbbVie Inc. (Parent)</company>
<displayName>Tj Tang</displayName>
<upi>10025613</upi>
<firstName>
<preferred>TJ</preferred>
<given>Tze-John</given>
</firstName>
<middleName/>
<lastName>
<preferred>Tang</preferred>
<given>Tang</given>
</lastName>
<secondaryLastName/>
<address>
<streetAddress>1 N Waukegan Road</streetAddress>
<buildingCode>AP52</buildingCode>
<city>North Chicago</city>
<state>Illinois</state>
<country>
<code>US</code>
<name>United States</name>
</country>
</address>
<emailAddress>tze-john.tang@abbvie.com</emailAddress>
<title>Principal Research Scientist</title>
<managerUpi>10009618</managerUpi>
</person>当我使用以下命令搜索时:
search:search("Tang TJ AbbVie")我得到了:
<search:snippet>
<search:match path="fn:doc("/person/10025613.xml")/person/company"><search:highlight>AbbVie</search:highlight> Inc. (Parent)
</search:match>
<search:match path="fn:doc("/person/10025613.xml")/person/displayName">Tj <search:highlight>Tang</search:highlight></search:match>
<search:match path="fn:doc("/person/10025613.xml")/person/firstName">
<search:highlight>TJ</search:highlight>
</search:match>
<search:match path="fn:doc("/person/10025613.xml")/person/lastName">
<search:highlight>Tang</search:highlight>
</search:match>
</search:snippet>它向我显示了匹配的元素,即match在/person/firstName/preferred中,它显示/person/firstName。
如果我搜索UPI值:
search:search("10025613")我得到了:
<search:snippet>
<search:match path="fn:doc("/person/10025613.xml")/person">
<search:highlight>10025613</search:highlight>
</search:match>
</search:snippet>在这种情况下,我甚至没有获得上下文的较低级别的元素。如何在代码片段上确定元素路径?我尝试为UPI值添加一个元素范围索引,但仍然得到相同的结果。
发布于 2016-05-05 07:43:25
搜索API处理匹配是嵌入式内联元素的全部内容的情况,如下所示:
<p>Before the <b>match</b> and after</p>在这种情况下,搜索API将使用inline元素前后的文本作为代码片段(而不是不为匹配提供代码片段)。
为了正确处理这种情况,搜索API必须将其与匹配在结构中的叶元素的整个内容上的情况区分开来。
上面的upi元素是叶元素情况的一个示例。
在8.0-5之前的版本中,搜索API可能有一个错误,将叶子元素的大小写与嵌入式内联大小写混淆。
希望这能澄清,
https://stackoverflow.com/questions/36974255
复制相似问题