Solr: where to store additional information?

前端 未结 1 441
独厮守ぢ
独厮守ぢ 2021-01-28 05:11

I want to provide additional information per each indexed document during index time.
And access this information in the same analyzer during query time to compare it.
S

相关标签:
1条回答
  • 2021-01-28 05:52

    Your example sounds like something which will be better suited to be handled by custom Similarity or a query function in Solr and not as a custom analyzer.

    For example if using Solr 4.0 you can use the function termfreq(field,term) to order by the number of times dog appears. or you can use it as a filter like so:

    fq={!frange l=3 u=100000}termfreq(animals,"dog")
    

    This will filter all documents whose animals field doesn't have at least 3 occurrences of the word dog. The advantage of using this method is that you don't affect the scoring of the documents only filter them.

    The ability to filter by function exists since Solr 1.4 so even if you are using an earlier version of Solr (>1.4) you can easily write the "termfreq" function query yourself

    0 讨论(0)
提交回复
热议问题