2012-07-08 155 views
10

我试图用Django-haystack Beta 2.0.0来设置Solr 3.6.0。Solr找不到资源stopwords_en.txt

运行./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到/示例/ 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

,我必须修改什么文件来解决这个问题?

回答

7

它无法找到stopwords_en.txt文件中的类路径。您应该将stopwords_en.txt文件添加到solr/conf/目录中。你可以找到关于禁用词here.

+1

为我工作...!+ 1 – mcacorner 2014-10-10 06:24:36

2

您必须在路径中放置stopwords_en.txt。 制作文件名stopwords_en.txt并粘贴到schema.xml旁边。 我希望你知道什么是禁用词过滤器用于.....

6

一个更好的办法是找到stopwords_en.txt中出现的所有schema.xml中替换它们朗/ stopwords_en.txt

1

要合并的所有详细信息上述三个答案,你需要的stopwords_en.txt,因为它开始测试英语语言文本

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

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

从相关性的角度来看,这些极高频率的术语 倾向于甩掉评分算法,并且如果您离开它们,结果将不会很好。与此同时,如果您删除它们,那么在停用词非常重要时,您可能会返回错误结果 。

从性能角度来看,如果您保留停用词,某些查询 (特别是词组查询)可能会非常缓慢。

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

如果您有磁盘空间,您可以进行一种权衡:您可以使用 CommonGramsFilter/CommonGramsQueryFilter而不是StopFilter。这个 解决了相关性和性能问题,甚至牺牲了更多的资源利用率,因为它将形成停用词 与它们相邻的词的大字。

你需要做的就是复制位于您的Solr目录的/ conf目录/郎文件夹中的原始版本逼到/ conf目录

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

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

conf/lang目录包含stopwords_en.txt。

0

我有同样的问题,事实证明,当我创建我的stopwords_en.txt文件时,我意外地创建了stopwords_en.txt.txt文件。重新创建它作为正确的.txt文件解决了问题