如何在compass-lucene搜索中使用分析器

发布于 2024-09-24 07:27:25 字数 194 浏览 6 评论 0原文

如何在罗盘中索引和搜索数据时添加罗盘分析器。我正在使用基于模式的罗盘配置。我想使用没有停用词的 StandardAnalyzer。因为我想按原样索引数据,而不忽略像 AND 、 OR 这样的搜索词, 在 。默认分析器将忽略我为索引提供的数据中的 AND 、 OR 、 IN 。

如何通过代码或 xml 配置 Snowball 分析器。如果有人能给我举个例子。

How do I add compass analyzer while indexing and searching data in compass.I am using schema based configuration for compass.I want to use StandardAnalyzer with no stopwords.Because I want to index data as it is,without ignoring search terms like AND , OR , IN . The default analyzer will ignore AND , OR , IN from the data I give for indexing.

How do I configure snowball analyzer either thru code or thru xml. If someone could post me an example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深缘浅 2024-10-01 07:27:25

下面是示例。您还可以在此处找到更多详细信息

<comp:searchEngine useCompoundFile="false" cacheInvalidationInterval="-1">
        <comp:allProperty enable="false" />
        <!--
            By Default, compass uses StandardAnalyzer for indexing and searching. StandardAnalyzer
            will use certain stop words (stop words are not indexed and hence not searcheable) which are
            valid search terms in the DataSource World. For e.g. 'in' for Indiana state, 'or' for Oregon etc.
            So we need to provide our own Analyzer.
        -->
        <comp:analyzer name="default" type="CustomAnalyzer"
            analyzerClass="com.ICStandardAnalyzer" />
        <comp:analyzer name="search" type="CustomAnalyzer"
            analyzerClass="com.ICStandardAnalyzer" />
        <!--
            Disable the optimizer as we will optimize the index as a separate batch job

            Also, the merge factor is set to 1000, so that merging doesnt happen during the commit time.
            Merging is a time consuming process and will be done by the batched optimizer
        -->
        <comp:optimizer schedule="false" mergeFactor="1000"/>
    </comp:searchEngine>

Below is the example. You can also find more details here

<comp:searchEngine useCompoundFile="false" cacheInvalidationInterval="-1">
        <comp:allProperty enable="false" />
        <!--
            By Default, compass uses StandardAnalyzer for indexing and searching. StandardAnalyzer
            will use certain stop words (stop words are not indexed and hence not searcheable) which are
            valid search terms in the DataSource World. For e.g. 'in' for Indiana state, 'or' for Oregon etc.
            So we need to provide our own Analyzer.
        -->
        <comp:analyzer name="default" type="CustomAnalyzer"
            analyzerClass="com.ICStandardAnalyzer" />
        <comp:analyzer name="search" type="CustomAnalyzer"
            analyzerClass="com.ICStandardAnalyzer" />
        <!--
            Disable the optimizer as we will optimize the index as a separate batch job

            Also, the merge factor is set to 1000, so that merging doesnt happen during the commit time.
            Merging is a time consuming process and will be done by the batched optimizer
        -->
        <comp:optimizer schedule="false" mergeFactor="1000"/>
    </comp:searchEngine>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文