Solr Facet 的活动日期

发布于 2024-12-19 08:39:15 字数 720 浏览 4 评论 0原文

我有一个事件表,它有这样的开始日期和结束日期

==============================================
id   |   name       | start_date |  end_date
==============================================
1    | Test Event 1 | 2011-11-20 | 2011-12-20 
----------------------------------------------
2    | My Event 2   | 2011-12-05 | 2011-12-26 
----------------------------------------------
3    | My Event 3   | 2012-12-26 | 2012-01-11
----------------------------------------------

现在我想要一个像这样的 solr 方面,但我似乎无法正确获取参数。

==================
Dates 
------------------
Today [2]
This Week [2]
This Month [2]
Next Month [1]

请注意,该方面必须考虑开始日期和结束日期。有点像组平?

这个的分面参数应该是什么?

预先感谢您的任何帮助。

I have an event table which has start date and end date like this

==============================================
id   |   name       | start_date |  end_date
==============================================
1    | Test Event 1 | 2011-11-20 | 2011-12-20 
----------------------------------------------
2    | My Event 2   | 2011-12-05 | 2011-12-26 
----------------------------------------------
3    | My Event 3   | 2012-12-26 | 2012-01-11
----------------------------------------------

Now I want to have a solr facet which looks like this and i can't seem to get the params right.

==================
Dates 
------------------
Today [2]
This Week [2]
This Month [2]
Next Month [1]

Please note that the facet has to consider both start date and end date. Sort of gouping ?

What should be the faceting parameters for this ?

Thanks in advance for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懷念過去 2024-12-26 08:39:15

我终于使用基于示例的日光浴室库 Facet Multi Query 使其工作 http:// wiki.solarium-project.org/index.php/V2:Facet_multiquery

我的 Zend 应用程序中的部分看起来像

$dateFacetSet = $query->getFacetSet();
$dateFacet = $dateFacetSet->createFacetMultiQuery('dates');
$dateFacet->createQuery('Today', 'type:event AND sdate:[* TO NOW/DAY] AND edate:[NOW/DAY TO * ]');
$dateFacet->createQuery('This-Week', 'type:event AND sdate:[* TO ' . $this->view->date_w["end"] . 'T23:59:59Z] AND edate:[' . $this->view->date_w["start"] . 'T00:00:00Z TO * ]');
$dateFacet->createQuery('This-Month', 'type:event AND sdate:[* TO ' . $this->view->date_m["end"] . 'T23:59:59Z] AND edate:[' . $this->view->date_m["start"] . 'T00:00:00Z TO * ]');

如果有人想了解更多信息,请告诉我。

这些参数捕获了我到目前为止所需的内容,但尚未进行广泛的测试。

I finally got it working using solarium libraries Facet Multi Query based on the example http://wiki.solarium-project.org/index.php/V2:Facet_multiquery

The part in my Zend App looks like

$dateFacetSet = $query->getFacetSet();
$dateFacet = $dateFacetSet->createFacetMultiQuery('dates');
$dateFacet->createQuery('Today', 'type:event AND sdate:[* TO NOW/DAY] AND edate:[NOW/DAY TO * ]');
$dateFacet->createQuery('This-Week', 'type:event AND sdate:[* TO ' . $this->view->date_w["end"] . 'T23:59:59Z] AND edate:[' . $this->view->date_w["start"] . 'T00:00:00Z TO * ]');
$dateFacet->createQuery('This-Month', 'type:event AND sdate:[* TO ' . $this->view->date_m["end"] . 'T23:59:59Z] AND edate:[' . $this->view->date_m["start"] . 'T00:00:00Z TO * ]');

If anyone wants to know more, please let me know.

These params catch what i needed so far but haven't tested extensively.

舞袖。长 2024-12-26 08:39:15

你可以把
$startdate.'T01:00:59Z'
$enddate.'T23:59:59Z'

You can put
$startdate.'T01:00:59Z'
$enddate.'T23:59:59Z'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文