【问题标题】:Marklogic field search optionsMarklogic 字段搜索选项
【发布时间】:2017-03-31 00:27:31
【问题描述】:

我有如下搜索选项

let $options :=
 <options xmlns="http://marklogic.com/appservices/search">
    <constraint name="collection">
        <collection prefix=""/>
    </constraint>
    <constraint name="concept_name">
        <word>
            <field name="concept_name" collation="http://marklogic.com/collation/en/S1"/>
        </word>
    </constraint>
    <term>
        <term-option>case-insensitive</term-option>
        <term-option>punctuation-insensitive</term-option>
        <term-option>whitespace-insensitive</term-option>
        <term-option>wildcarded</term-option>
    </term>
    <return-facets>false</return-facets>
    <return-values>false</return-values>
    <return-constraints>false</return-constraints>
    <return-frequencies>false</return-frequencies>
    <return-qtext>false</return-qtext>
    <search-option>format-json</search-option>
    <search-option>score-simple</search-option>
</options>

然后搜索search:search($q, $options, $start, $page-length)

但搜索不做 case-insensitive。在这种情况下如何告诉我为 field.. 指定选项。我希望它是 case-insensitive

当我这样做时 cts:field-value-match("concept_name", $q ("case-insensitive", "diacritic-insensitive")) ,我确实得到了正确的结果,那么我该如何指定使用上面的搜索选项来做同样的事情。

【问题讨论】:

    标签: marklogic marklogic-8


    【解决方案1】:

    我认为您希望您的 &lt;term-option&gt;case-insensitive&lt;/term-option&gt; 包含在您的 &lt;constraint...&gt;&lt;word&gt; 元素中。这样,该选项会影响您使用该约束的搜索。但是,您还没有分享您的 $q(serach 字符串),所以我不确定您正在测试什么搜索。

    您应该注意,cts:field-word-match 将在字段词词典中进行搜索,因此比匹配字段范围索引中的值的 cts:field-value-match 更适合您正在执行的搜索:搜索。

    无论如何,我不确定您在数据库或字段中的选项是什么,因此不清楚您为什么要努力获得不区分大小写的匹配项。当我尝试cts:field-word-match("concept_name", "alexa488", ("collation=http://marklogic.com/collation/en/S1")) 时,即使我没有添加case-insensitive 选项,我也会得到匹配。同样,当我尝试 search:search with no &lt;term-option&gt;case-insensitive&lt;/term-option&gt; 时,我得到了一个匹配项。

    【讨论】:

    • 我已经对搜索进行了词干搜索:基本、单词搜索、字段值搜索、字段值位置、快速短语搜索、尾随通配符搜索、尾随通配符单词位置、三个字符搜索我还添加了术语约束中的选项和相同的问题.. 有趣的是做 cts: 有效,但 search: 没有..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多