Rene
(Rene Groeschke)
Fevereiro 19, 2016, 8:48am
1
Hey there,
in our forum ( http://discuss.gradle.org ) we’d like to filter for all topics with no replies older than a day or two. It seems that min_age:1 is not respected when configured in a query. sample query:
Am I missing something obvious here or can you acknowledge that this is a bug?
cheers,
René
Are these the correct search querystrings, @sam ?
cpradio
(cpradio)
Fevereiro 19, 2016, 5:32pm
3
Not sure if this is a bug or just a contextual wording problem, but the query you want to use is
That seems to do what you were wanting.
Looking at the code
advanced_filter(/min_age:(\d+)/) do |posts,match|
n = match.to_i
posts.where("topics.created_at > ?", n.days.ago)
end
advanced_filter(/max_age:(\d+)/) do |posts,match|
n = match.to_i
posts.where("topics.created_at < ?", n.days.ago)
end
They seem to be doing the reverse of what they describe (depending how you look at it). min_age is saying it has to be created after X days ago, and max_age is saying it should be created prior to X days ago.
2 curtidas
Rene
(Rene Groeschke)
Fevereiro 20, 2016, 12:44am
4
thanks for clarifying. but this is quite confusing behaviour, isn’t it?
Mittineague
(Mittineague)
Fevereiro 20, 2016, 12:53am
5
Not to me, but I guess it’s
To me “min_age” means “not newer than this” and
“max_age” means “not older than this”
3 curtidas
sam
(Sam Saffron)
Fevereiro 23, 2016, 12:10am
6
I am open to changing the words here, its the second time it has tripped people. Any suggestions for better terms to describe this ?
older_than and newer_than ?
cpradio
(cpradio)
Fevereiro 23, 2016, 12:16am
7
You know, I’ve been wondering the same thing, but I haven’t really come up with anything better than older_than and newer_than either.
Mittineague
(Mittineague)
Fevereiro 23, 2016, 12:18am
8
Maybe part of it is “lower” dates are older while “higher” dates are newer?
Maybe before and after?
A difference would be max and min are inclusive, but before and after are exclusive
“on or before”, and “on or after”, are a bit too wordy IMHO and not everyone would understand <= >=
2 curtidas
before and after seem like nice clear simple words, what do you think @sam ?
sam
(Sam Saffron)
Fevereiro 23, 2016, 2:11am
10
Issue with before is that it does not read right.
Slack allow for before but it is way more fancy … before:june , before:yesterday , before:2016-02-17 all work there .
I guess we can go with before but add that support … should be fairly simple to support some basics there. localizing is very tricky though.
2 curtidas
Rene
(Rene Groeschke)
Fevereiro 24, 2016, 7:12am
11
Thanks to all of you for your support here.
I like this proposal before:yesterday or before:2d is what we’re looking for.
cheers,
René
sam
(Sam Saffron)
Março 14, 2016, 12:45pm
12
Ok this is now significantly simplified per
This guide explains how to use Discourse’s search functionality to find posts created within a certain timeframe.
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 …
@Rene let me know what you think
4 curtidas
Rene
(Rene Groeschke)
Março 15, 2016, 10:03am
13
cool. Thanks again for the work on this. looks good to me.
2 curtidas