Get the result of an analysis as a JSON in SolR

梦想与她 提交于 2019-12-24 02:43:22

问题


I made a filter in SolR as following :

<fieldtype name="tokenization_stopwords" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>  
  </analyzer>
</fieldtype>     

When I'm using this filter in the "Analysis" section, it works. However, I'd like to be able to get the result of this analysis as a JSON. Does anyone knows how to do this ?


回答1:


In order to get that you need to configure the FieldAnalysisRequestHandler in your solrconfig.xml and ask him questions.

<requestHandler name="/analysis/field" class="solr.FieldAnalysisRequestHandler"/>

The request would look like this

http:// localhost:8989/solr/analysis/field?wt=json&analysis.fieldvalue=test+dog+cat&analysis.fieldtype=tokenization_stopwords

For more information have a look in the javadoc of the FieldAnalysisRequestHandler



来源:https://stackoverflow.com/questions/19453220/get-the-result-of-an-analysis-as-a-json-in-solr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!