Comments (5)
Hi @GuyAv46 great work!! I have also tested your implementation on my instances, and it works like a charm.
from redisearch.
Yes, just looking at the fast_timegm() function, the issue might be here:
tdays = tdays + (tyears * 365) + leaps;
Because 2024 is a leap year, and leap year day happens on the 29th Feb. However, the algorithm is very crude and just adds a day for the year, which means the output will be incorrect from Jan 1 to Feb 28, then presumably correct again after Mar 1.
from redisearch.
As a quick test, I made this patch:
...
tdays += ltm->tm_mday - 1; // days of month passed.
if ((tyears + 2) % 4 == 0) {
if (tdays <= (31 + 29)) {
tdays -= 1;
}
}
tdays = tdays + (tyears * 365) + leaps;
...
Ie, it will only add the leap year's day from Mar 1 onwards. Seems to fix the issue for my case above, but needs further testing for Feb 29 and Mar 1.
from redisearch.
Nice catch! Thanks for reporting.
I think a faster and simpler solution would be not to include the current year if it is a leap year, and to use tm_yday
which counts the number of days from the beginning of the year including a leap day if there was one.
here is a correction check for my solution, compared to the existing implementation. Notice that I use leaps = (tyears + 1) / 4;
to not include the current year, instead of leaps = (tyears + 2) / 4;
And here is a performance comparison of the fix, and here compared to the standard function
from redisearch.
Fixed. Available on master and version branches.
Will be part of v2.6.16
and v2.8.12
from redisearch.
Related Issues (20)
- Redis 6.2.13 crashed by signal: 4, si_code: 2 HOT 5
- Clarification on non-indexed attributes HOT 10
- Unclear time complexity for FT.SEARCH HOT 2
- README missing build instructions HOT 2
- [Help] Highlighting unexpected error No such property `title` HOT 3
- How to debug a query to understand that how it working specially weight with fields? HOT 1
- [BUG] Optimizer single item not returned HOT 6
- JSON index query returns incorrect results with tag filter HOT 3
- [BUG] Redis became unrepsponsive HOT 2
- [BUG] Searching for special capital letters HOT 2
- Not generating redisearch.so HOT 1
- [Question] Restarting redisearch sometimes doesn't reload all indexes from disk HOT 9
- RediSearch dead-lock HOT 3
- [QUESTION] Wildcards not working inside the string HOT 4
- [BUG] Error while trying to create RedisEnterpriseDatabase on Openshift 4.14.8
- del key HOT 1
- [Feature Request] ft.dropindex work synchronously and if it takes a long time, server will hang.
- [Help] CPU utilization remains consistently high after complex hybrid searches utilizing MT mode. HOT 2
- [BUG] Is There a offset limit when using `limit offset num` HOT 3
- [BUG] Redis Search silently fails to Sort when the index schema is too large HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redisearch.