Get the result of an analysis as a JSON in SolR

2019-07-26 18:35发布

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条回答
我命由我不由天
2楼-- · 2019-07-26 18:53

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

查看更多
登录 后发表回答