【问题标题】:all time data without setting facet.date.start to a random past date没有将 facet.date.start 设置为随机过去日期的所有时间数据
【发布时间】:2011-10-03 23:13:46
【问题描述】:

我使用以下查询来获取帖子的时间序列数据。

q=*:*&facet=true&facet.date=created_at_d&start=0
&f.created_at_d.facet.date.start=2009-06-20T14:05:28Z
&f.created_at_d.facet.date.end=2011-07-05T14:05:28Z
&f.created_at_d.facet.date.gap=%2B3600SECONDS
&fq=type:Post&rows=0&f.created_at_d.facet.mincount=1
&facet.sort=count

有没有办法在不将 facet.date.start 设置为随机过去日期(比如 100 年)的情况下获取所有时间数据?

All time data => from the created_at of the very first Post.

【问题讨论】:

  • 我正忙着在网上搜索相同问题的答案。你当时找到了吗?
  • 在 Solr 中没有办法。我们创建了 $posts_first_created_at=Post.first.create_at 来存储 Rails 初始化期间的值。该代码仅在 JVM(我们使用 tomcat/jruby)启动期间运行一次。

标签: solr sunspot sunspot-rails


【解决方案1】:

这是对 solr 或您的数据库的单独查询,以查找第一个日期,因此可能最容易从数据库中获取。

Post.first(:order => 'created_at ASC').created_at.iso8601

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-12
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    • 2021-02-23
    相关资源
    最近更新 更多