-->

request counting for documents in apache solr

2020-08-01 07:28发布

问题:

I have a simple website that is using apache solr for request of specific documents. Now I have to count the total number of request for each document served. I know that I have to use some database for this purpose. But I do not know how to update documents in database on fly i.e. when documents are served. I have used DIH to import documents from mysql to solr. How do I do it.

回答1:

please be more specific about your use-case.

I will answer for this question: What should I do to count all delivered documents and use the count to change the ranking of my documents?

  1. Count per document(-ID)

If you really can not do this inside your application than generate your own SearchComponent to collect the document-Ids from the result-DocSet. Use StatsComponent as starting point.

  1. Use a dynamic count per document for ranking

Updating a solr-document is expensive. So use ExternalFileField: External File Field in Apache Solr



回答2:

You can use Schema browser to view frequency of search in solr.

You can view on every field.

Histogram represents top searches and their frequency for terms.

But to update you need your own search component that updates count in database.



标签: mysql solr