Does Solr's “More like this” support facet que

2019-05-20 21:53发布

问题:

I have been able to facet and highlight with the Dismax handler.

I tried to do faceting for More Like This results, such as this query: "fetch documents similar to '11qualcomm.doc' whose 'doc_keywords' has 'Communication' as mandatory.

select?
facet=on&facet.field=doc_keywords&facet.mincount=1
&fl=id,score
&fq=doc_keywords:%22Communication%22
&indent=true
&mlt=true&mlt.count=20
&mlt.fl=doc_keywords_searchable,doc_author_searchable,doc_abstract,text&mlt.mindf=1&mlt.mintf=1
&mlt.qf=doc_keywords_searchable%5E15+doc_author_searchable%5E15+doc_abstract%5E10+text
&q=id:%2211qualcomm.doc%22
&rows=1&wt=python

But the results are:

'facet_counts':{
    'facet_queries':{},
    'facet_fields':{
      'doc_keywords':[
        'Communication',1,
        'Corporation',1]},
    'facet_dates':{},
    'facet_ranges':{}}

Which implies that the faceting only worked for q=id:"11qualcomm.doc" and not for the MLT result set.

Does faceting work for the MLT result set? If yes, what am I doing wrong?

回答1:

Found the answer myself. I am supposed to use the More Like This handler, instead of using the MLT of the search handler. The MLT handler "supports faceting, paging, and filtering using CommonQueryParameters" (from wiki).

  • The two ways to enable MLT functionality http://wiki.apache.org/solr/MoreLikeThis

  • More Like This handler http://wiki.apache.org/solr/MoreLikeThisHandler#Examples



回答2:

Filter queries were recently added as an support for the Solr More Like this feature.
https://issues.apache.org/jira/browse/SOLR-2351

The fix version marked however is 3.5 and 4.0, so it may not work for you.
Can check for the patch or upgrade.