English 中文(简体)
Solr 面面射法
原标题:Solr facet pagination

在索尔,我怎样才能在一面数上排成一面呢?我知道我有可以跳过记录的一个面数,但是我怎么知道有多少个面数记录呢?

最佳回答

You need to apply Solr Patch SOLR-2242 to get the Facet distinct count.
The total count can be helpful to paginate.

问题回答

在Solr 5.3及以上,使用面图获得文件总数,

那对于你们是纯洁的、

facet=on

例如,例如

http://<solr-url>/select?facet=on&indent=on&q=*:*&rows=0&wt=json

然后得到一个侧面对象的响应, 它会看起来像,

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":3,
    "params":{
      "q":"*:*",
      "indent":"on",
      "rows":"0",
      "facet":"on",
      "wt":"json"}},
  "response":{"numFound":8,"start":0,"maxScore":1.0,"docs":[]
  },
  "facet_counts":{
    "facet_queries":{},
    "facet_fields":{},
    "facet_ranges":{},
    "facet_intervals":{},
    "facet_heatmaps":{}}
}

您从 reponse 获得 numFound ,这是该索尔核心中的记录的总数。

<更强 > 另一种方式

如果有任何面对面的查询,请使用,

facet=on&json.facet={}

例如,例如

http://<solr-url>/select?facet=on&indent=on&json.facet={}&q=*:*&rows=0&wt=json

然后得到一个侧面对象的响应, 它会看起来像,

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":3,
    "params":{
      "json.facet":"{}",
      "q":"*:*",
      "indent":"on",
      "rows":"0",
      "facet":"on",
      "wt":"json"}},
  "response":{"numFound":80,"start":0,"maxScore":1.0,"docs":[]
  },
  "facet_counts":{
    "facet_queries":{},
    "facet_fields":{},
    "facet_ranges":{},
    "facet_intervals":{},
    "facet_heatmaps":{}},
  "facets":{
    "count":80}}

facets 对象获得 count count ,这是记录的最大数量。





相关问题
SELECT command to calculate percentage

I m trying to get the percentage of each video I have in my database based on its view count against all other videos. I m then trying to display all the videos from highest view count to lowest, ...

Consolidating a COUNT query

I have a page where I am running an initial SQL query to get a list of subjects, then I loop over this query and run two additional queries for each record returned from the original subjects query (I ...

R: Count number of objects in list [closed]

Can someone recommend a function that can allow me to count and return the number of items in a list? library(stringr) l <- strsplit(words, "a") if(# number of items in list l < 1) ...

Mysql get count of rows for each day

My Current query is: SELECT DISTINCT DATE(vote_timestamp) AS Date, COUNT(*) AS TotalVotes FROM `votes` WHERE vote_target_id= 83031 GROUP BY DATE(vote_timestamp) ORDER BY DATE(vote_timestamp) DESC ...

Group by named column

I always forget how to do things like this. I have a database table with birthdates and I want to find out how many people have the same age. I m trying: SELECT TIMESTAMPDIFF( YEAR, birthdate, ...

TableView oval button for Index/counts

Can someone help me create an index/count button for a UITableView, like this one? iTunes http://img.skitch.com/20091107-nwyci84114dxg76wshqwgtauwn.preview.jpg Is there an Apple example, or other ...

热门标签