Ask questionsStore the segment hash in the DB table
refs https://github.com/matomo-org/matomo/issues/17050 which we're currently still discussing and looking into.
In any case I'm thinking to fix the segment hash problem hopefully once and for all I think we should introduce a new column to the segment DB table that stores the segment hash that will be used when fetching archives etc. This will also make it future proof if we ever change the segment definition and/or if we change the calculation for hashes etc without needing to update any archives etc.
We would basically need an update script that sets the correct hashes for any existing segment. And then adjust https://github.com/matomo-org/matomo/blob/4.2.1/core/Segment.php#L464 to try and find a matching hash from the segment DB table. We might need to encode / decode a segment definition to see if we find a match in the table.
@diosmosis do you think that would be useful? If so I reckon we could start working on this already as it's independent of a decision for #17050 which will probably still need a while (@mattab and I already quickly talked about it but need more time)
Answer
questions
tsteur
This solution seems a bit like taking on tech debt, but it's also very low risk, so it's probably the best short term solution 👍
I'm thinking it's actually the best long term solution since you want to be able to change the algorithm for how to calculate the hash at any time (eg different segment string or do it based on parsed segment expression). There is of course still the urlencode/urldecode thing but that's a different problem which we eventually will hopefully tackle with #17050 .
Related questions