我发现它支持很多语言,但支持中文。
更新 我可以使用 Luke 搜索我的数据,请看截图 试过这个:添加
<fieldType name="text_chinese" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.CJKTokenizerFactory"/>
</analyzer>
</fieldType>
到schema.xml,也试过
<fieldType name="text_chinese" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.cn.ChineseAnalyzer"/>
</fieldType>
和
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.CJKTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
但这些都不起作用。我想知道“ <fieldType name=
”的格式到底是什么,是text_chinese还是text_cn还是text_zh_cn?但我已经尝试过所有这些格式。
顺便说一句,我可以使用 engnlish 属性搜索我的文档。而且我无法通过在我的网络浏览器 UI 中输入“name:something”进行搜索,我遇到了异常:
org.springframework.dao.InvalidDataAccessApiUsageException: Bad Request
Bad Request
request: http://localhost:8180/solr/select?q=name:*name:something* or description:*name:something* or type:*name:something* or mac_address:*name:something* or uri:*name:something* or attrs:*name:something*&start=0&rows=0&wt=javabin&version=2; nested exception is org.apache.solr.common.SolrException: Bad Request
Bad Request
request: http://localhost:8180/solr/select?q=name:*name:something* or description:*name:something* or type:*name:something* or mac_address:*name:something* or uri:*name:something* or attrs:*name:something*&start=0&rows=0&wt=javabin&version=2
at org.springframework.data.solr.core.SolrExceptionTranslator.translateExceptionIfPossible(SolrExceptionTranslator.java:58)
at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:106)
at org.springframework.data.solr.core.SolrTemplate.count(SolrTemplate.java:126)
at org.springframework.data.solr.repository.query.AbstractSolrQuery$CollectionExecution.count(AbstractSolrQuery.java:92)
at org.springframework.data.solr.repository.query.AbstractSolrQuery$CollectionExecution.execute(AbstractSolrQuery.java:87)
at org.springframework.data.solr.repository.query.AbstractSolrQuery.execute(AbstractSolrQuery.java:52)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:313)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
这是春季数据解决方案错误吗?