البحث عن المشاركات التي تم إنشاؤها خلال إطار زمني معين

:bookmark: This guide explains how to use Discourse’s search functionality to find posts created within a certain timeframe.

:person_raising_hand: Required user level: All users

Discourse’s search interface allows you to scope your searches to specific date ranges using the before and after search clauses. This feature can be particularly useful when you need to find posts from a certain period or within a specific timeframe.

Using the before and after clauses

The before and after clauses accept the following date formats:

  • Full date (YYYY-MM-DD)
  • Name of month
  • Day of week

Here are some examples to help you understand how to use these clauses:

  1. before:june hashtag

    • This will find posts with the term “hashtag” that were created before last June.
  2. before:2014 category:bug order:latest

    • This search will return posts in the “bug” category created before 2014, ordered by the most recent first.
  3. after:friday broken

    • This will find posts containing the word “broken” that were created after last Friday.
  4. after:2016-01-12 before:2016-01-20 happy

    • This search will return posts containing the word “happy” that were created between January 12, 2016, and January 20, 2016.
  5. after:june before:july in:first composer

    • This will search for the word “composer” in the first post of topics created between last June and last July.
  6. after:10 before:8 thing

    • This search will find posts containing the word “thing” that were created between 8 and 10 days ago.

Important notes

  • All dates are in UTC (Coordinated Universal Time).
  • The search uses the beginning of the day (00:00:00 UTC) as the start time for any period.
  • The filter applies to the created_at date of posts, not the date a topic was created.
  • If you need to filter based on topic creation date, use the in:first clause in your search query.

Limitations

Currently, the search function does not support sub-day resolution without specifying a full qualified date. For example, searching for posts that are at least 2 hours old using before:2h or before:120m is not possible.

:bulb: If you need more precise time-based filtering (e.g., posts older than 2 hours), consider using a Data Explorer report. This can be especially useful for support teams who need to give community members a chance to answer questions before intervening.

Last edited by @hugh 2024-07-02T09:45:57Z

Last checked by @hugh 2024-07-02T09:46:04Z

Check documentPerform check on document:
13 إعجابًا

ما هي الوحدات المتاحة لعمليات البحث after: و before:؟ أرى أن الوحدات الافتراضية هي الأيام، هل يمكننا الحصول على دقة دون يومية دون تحديد تاريخ مؤهل بالكامل؟

حالة الاستخدام المحددة الخاصة بي: أرغب في إرجاع المشاركات التي يزيد عمرها عن ساعتين. أعتزم استخدام in:first لالتقاط المواضيع التي تم إنشاؤها منذ أكثر من ساعتين.

لقد جربت before:2h و before:120m و before:02:00:00 ولكن لم ينجح أي منها.

السبب: يريد فريق الدعم لدينا منح أعضاء المجتمع فرصة للإجابة على الأسئلة قبل أن يتدخلوا ويحاولوا حل طلبات المساعدة.

إعجاب واحد (1)

قد يكون تقرير مستكشف البيانات المتاح لفريق الدعم الخاص بك خيارًا أكثر ملاءمة إذا كنت بحاجة إليه لفترة أقصر من يوم. يمكنهم بعد ذلك إضافته إلى الشريط الجانبي الخاص بهم والاحتفاظ به في متناول اليد لتشغيله عند الحاجة. :+1:

3 إعجابات