Solr找不到资源stopwords_en.txt

时间:2012-07-08 21:37:06

标签: django solr django-haystack stop-words

我正在尝试使用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

我必须编辑哪个文件才能解决此问题?

5 个答案:

答案 0 :(得分:7)

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

的更多信息

答案 1 :(得分:6)

更好的方法是在 schema.xml 中找到所有 stopwords_en.txt ,并将其替换为 lang / stopwords_en.txt < / p>

答案 2 :(得分:2)

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

答案 3 :(得分:1)

要结合上述所有三个答案,您需要在开始测试英语语言文字时使用stopwords_en.txt

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

  

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

     

从相关性的角度来看,这些极高频率的术语   倾向于放弃评分算法,你不会变得非常好   结果如果你离开他们。同时,如果你删除它们,你   当禁用词实际上很重要时,可以返回错误的结果。

     

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

     

从资源利用的角度来看,如果你保留停用词,那么   index比你删除它们要大得多。

     

如果你有磁盘空间,你可以做出一个权衡:你可以使用   CommonGramsFilter / CommonGramsQueryFilter而不是StopFilter。这个   以牺牲甚至为代价来解决相关性和性能问题   更多的资源利用率,因为它将形成一连串的停用词   他们相邻的话。

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

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

答案 4 :(得分:1)

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

conf / lang目录包含stopwords_en.txt。