【问题标题】:Solr can't find resource stopwords_en.txtSolr 找不到资源 stopwords_en.txt
【发布时间】:2012-07-08 08:55:10
【问题描述】:

我正在尝试使用 Django-haystack Beta 2.0.0 设置 Solr 3.6.0。

在运行./manage.py build_solr_schema 并将schema.xml 移动到conf 目录后,在访问http://localhost:8983/solr/admin 时,我收到一个与this thread 中产生的完全一样的错误。

org.apache.solr.common.SolrException: No cores were created, please check the logs for errors

java.lang.RuntimeException: Can't find resource 'stopwords_en.txt' in classpath or 'solr/./conf/', cwd=/home/randall/startupsearch_live/apache-solr-3.6.0/example

在帖子的底部,一位用户提到必须编辑 schema.xml 以将 stopwords_en.txt 与 /example/solr/conf/ 目录匹配,我通过符号链接和编辑所有实例都做到了这一点stopwords.txt 到生成的 schema.xml 文件中的 /solr/conf/stopwords_en.txt 。但是,同样的错误仍然存​​在,输出略有不同:

java.lang.RuntimeException: Can't find resource '/solr/conf/stopwords_en.txt' in classpath or 'solr/./conf/', cwd=/home/randall/startupsearch_live/apache-solr-3.6.0/example

我必须编辑什么文件来解决这个问题?

【问题讨论】:

    标签: django solr django-haystack stop-words


    【解决方案1】:

    您必须将 stopwords_en.txt 放在路径中。 创建一个文件名 stopwords_en.txt 并粘贴到 schema.xml 旁边。 我希望你知道使用什么停用词过滤器.....

    【讨论】:

      【解决方案2】:

      在类路径中找不到stopwords_en.txt 文件。您应该将stopwords_en.txt 文件添加到solr/conf/ 目录中。你可以找到更多关于停用词的信息here.

      【讨论】:

        【解决方案3】:

        更好的方法是在 schema.xml 中查找所有出现的 stopwords_en.txt 并将其替换为 lang/stopwords_en.txt

        【讨论】:

          【解决方案4】:

          要结合以上所有三个答案,您需要 stopwords_en.txt,因为它开始测试英语文本

          来自http://wiki.apache.org/solr/LanguageAnalysis#Stopwords

          停用词以三种方式影响 Solr:相关性、性能和 资源利用率。

          从相关性的角度来看,这些频率极高的术语 倾向于扔掉评分算法,你不会得到很好的 结果,如果你离开他们。同时,如果你删除它们,你 当停用词实际上很重要时,可能会返回不好的结果。

          从性能的角度来看,如果你保留停用词,一些查询 (尤其是短语查询)可能会很慢。

          从资源利用的角度来看,如果保留停用词,则 索引比删除它们时大得多。

          如果您有磁盘空间,您可以做出一个权衡:您可以使用 CommonGramsFilter/CommonGramsQueryFilter 而不是 StopFilter。这 解决了相关性和性能问题,甚至牺牲了 更多的资源利用,因为它会形成二元组的停用词 到他们相邻的单词。

          您需要做的是将位于 solr 目录的 /conf/lang 文件夹中的原始版本复制到 /conf 目录中

          cp PATH/TO/solr/conf/lang/stopwords_en.txt PATH/TO/solr/conf
          

          【讨论】:

            【解决方案5】:

            在 Solr 5 中,我遇到了同样的错误。我曾使用 Solr zookeeper cli shell 上传我的配置。我从 server/solr/configsets/basic_configs 复制了现有 solr 配置的内容,但不知何故错过了 lang 目录。

            conf/lang 目录包含 stopwords_en.txt。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2015-01-28
              • 2015-05-03
              • 2013-01-03
              • 2014-03-20
              • 2015-04-13
              • 2021-07-06
              • 1970-01-01
              相关资源
              最近更新 更多