Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Before and after relative date operator #81

Open
gbastien opened this issue Aug 22, 2017 · 2 comments
Open

Before and after relative date operator #81

gbastien opened this issue Aug 22, 2017 · 2 comments
Assignees

Comments

@gbastien
Copy link
Member

Hi everybody,

we need something that is not possible for now I think, it is a way to look for elements 30 days before a date and 30 days after. For now you may query 30 days before or 30 days after now but not in the interval.

Something like lessAndMoreThanRelativeDate in addition to existing _lessThanRelativeDate and _moreThanRelativeDate operators.

To enter value I would like to ease things by just setting one value (like "30") using this value for before/after, or a notation like 20:40 if we need different values for before and after.

Does that seem receivable, any hints or remarks?

Thank you,

Gauthier

@gbastien
Copy link
Member Author

Hi @esteele @mauritsvanrees @gforcada,

I come back with this ;-)

So what we intend to do is to search "30 days before now until 30 days after now".

As far as I see, this is not possible for now.

Instead adding a new widget that manages "from... to..." date, that would be nice to have some special handling when several configuration is defined for a single index. For now it overwrite existing value, but what would be nice is to be able to use this :

{u'i': u'start' u'o': u'plone.app.querystring.operation.date.lessThanRelativeDate', u'v': u'30'},
{u'i': u'start', u'o': u'plone.app.querystring.operation.date.largerThanRelativeDate', u'v': u'30'}

For now only the second is kept in the query and it results in a :

{'query': [DateTime(now), DateTime(now+30days)], 'range': 'minmax'}

It would be nice that the resulting query takes care of the 2 operators.

There is already some special handling for "path" index in queryparser.parseFormquery, I would add there some special handling for relativeDate operators.

What do you think? What is the best way to handle this?

Gauthier

@mauritsvanrees
Copy link
Member

Seems like a useful addition.

This sounds like a variant of the current 'between dates' query. So I would copy and adapt the _betweenDates query parser and integrate that.

If you want to, you could start with a single value, making the query between X days before and X days after now, and see if you can get that to work. Once this works, you can try X days before and Y days after.

But note that if you first do one single value and want to have this merged, and then work on expanding it to two values if a future PR, then this may require a migration.
But then: if you allow one value as input, but already store it as a double value, then migration should not be needed.

@gforcada gforcada removed their assignment Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants