问题
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