使用solr设置多核(可能相关或不相关),我有一个工作测试系统。 solrconfig.xml
住在/solr-4.4.0/example/multicore/expertise/conf
,看起来基本上类似于多核的示例solrconfig文件,但以下几行除外:
<dataDir>/data/website_data/solr_cores/expertise</dataDir>
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">/data/website_data/solr_cores/expertise/data-config.xml</str>
</lst>
</requestHandler>
由于我需要一个支持语言的solr,我使用一些选择处理程序(以前handleSelect
已经true
)和一个新的updateRequestProcessorChain
更新了solrconfig.xml。对solrconf.xml的更改如下所示:
<lib dir="${user.dir}/../contrib/analysis-extras/lucene-libs/" /><!-- relative to solrs 'example' directory -->
<lib dir="${user.dir}/../contrib/analysis-extras/lib/" />
<lib dir="${user.dir}/../dist/" regex="solr-langid-.*\.jar" />
<lib dir="${user.dir}/../contrib/langid/lib/" />
<!-- required for language detection of input records -->
<updateRequestProcessorChain name="languages">
<processor class="solr.LangDetectLanguageIdentifierUpdateProcessorFactory">
<lst name="invariants">
<str name="langid.fl">focus, expertise, platforms, partners, participation, additional</str>
<str name="langid.whitelist">en,fr</str>
<str name="langid.fallback">en</str>
<str name="langid.langField">detectedlang</str>
<bool name="langid.map">true</bool>
<bool name="langid.map.keepOrig">false</bool>
</lst>
</processor>
<processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>
<!-- uses language-detecting update.chain -->
<requestHandler name="/update" class="solr.UpdateRequestHandler">
<lst name="invariants">
<str name="update.chain">languages</str>
</lst>
</requestHandler>
<requestDispatcher handleSelect="false"> <!-- ORIGINALLY FALSE -->
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
<httpCaching never304="true" />
</requestDispatcher>
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="qf">focus^2, expertise^2, platforms, partners, participation, additional</str><!-- default query looks in these fields, with these boosts -->
<str name="f.focus.qf">focus_en focus_fr</str><!-- field alias 'focus' means en AND fr versions of focus -->
<str name="f.expertise.qf">expertise_en expertise_fr</str>
<str name="f.platforms.qf">platforms_en platforms_fr</str>
<str name="f.partners.qf">partners_en partners_fr</str>
<str name="f.participation.qf">participation_en participation_fr</str>
<str name="f.additional.qf">additional_en additional_fr</str>
</lst>
</requestHandler>
<requestHandler name="/selectEN" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="qf">focus^2, expertise^2, platforms, partners, participation, additional</str>
</lst>
<lst name="invariants">
<str name="fq">detectedlang:en</str>
<str name="f.focus.qf">focus_en</str>
<str name="f.expertise.qf">expertise_en</str>
<str name="f.platforms.qf">platforms_en</str>
<str name="f.partners.qf">partners_en</str>
<str name="f.participation.qf">participation_en</str>
<str name="f.additional.qf">additional_en</str>
<str name="uf">* -focus_* -expertise_* -platforms_* -partners_* -participation_* -additional_*</str><!-- direct query any field except language-defined ones -->
<str name="fl">*,focus:focus_en, expertise:expertise_en, platforms:platforms_en, partners:partners_en,
participation:participation_en, additional:additional_en</str><!-- return lang-defined field when asked for generic field -->
</lst>
</requestHandler>
<requestHandler name="/selectFR" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="qf">focus^2, expertise^2, platforms, partners, participation, additional</str>
</lst>
<lst name="invariants">
<str name="fq">detectedlang:fr</str>
<str name="f.focus.qf">focus_fr</str>
<str name="f.expertise.qf">expertise_fr</str>
<str name="f.platforms.qf">platforms_fr</str>
<str name="f.partners.qf">partners_fr</str>
<str name="f.participation.qf">participation_fr</str>
<str name="f.additional.qf">additional_fr</str>
<str name="uf">* -focus_* -expertise_* -platforms_* -partners_* -participation_* -additional_*</str><!-- direct query any field except language-defined ones -->
<str name="fl">*,focus:focus_fr, expertise:expertise_fr, platforms:platforms_fr, partners:partners_fr,
participation:participation_fr, additional:additional_fr</str><!-- return lang-defined field when asked for generic field -->
</lst>
</requestHandler>
现在我收到错误:
Can't find resource '/data-config.xml' in classpath or 'multicore/expertise/conf/', cwd=/solr-4.4.0/example</str>
数据路径没有改变。 data-config.xml文件存在于应该存在的位置,并且其权限是正确的。为什么我的原始solrconf.xml可以找到data-config.xml而我的新文件不能?
答案 0 :(得分:0)
似乎solrconfig.xml中的语句顺序可以有所不同。在这种情况下,任何<lib/>
声明都必须在其中一个(或可能是全部)声明之后:<luceneMatchVersion/>
,<directoryFactory/ >
,<dataDir>
,<schemaFactory/>
和{{1 }}。
最初,我的<updateHandler/>
行紧接在开始<lib>
标记之后。这恰好是他们在我工作的example中的位置。所以也许Java只是不合适而且我的solrconfig.xml没有问题。
我希望这有助于其他人。