drcmue4619 2015-12-14 15:28
浏览 61

如何从Apache Solr中的用户查询结果中获取最流行的数据?

I have configuration schema.xml:

<field name="id" type="int" indexed="true" stored="true" required=" multiValued="false" />
<field name="name" type="text_en" indexed="true" stored="true" />

<uniqueKey>id</uniqueKey>
<defaultSearchField>name</defaultSearchField>

<fieldType name="text_vi" class="solr.TextField" positionIncrementGap="100" sortMissingLast="true">
    <analyzer type="index">...
    <analyzer type="query">...
</fieldType>

In my application, user can search by field 'name'. Now, I want to get most popular data from user query results.

Can anyone explain the procedure step by step and provide example also? Thanks in advance !

  • 写回答

2条回答 默认 最新

  • doom910730 2015-12-14 20:55
    关注

    Solr doesn't provide any out of the box feature as such. You might take a look at statscomponent for index stats.
    If you trying to develop autocomplete features at term level then look at termscomponent, which provides top terms with number of matches.
    Top matching result you can sort using count-

    q=search_text:xyz&wt=json&indent=on&rows=50&sort=count desc
    
    评论

报告相同问题?