Allow filtering out of timeshifted itineraries with same routes and stops - #4298
Conversation
Codecov Report
@@ Coverage Diff @@
## dev-2.x #4298 +/- ##
=============================================
+ Coverage 57.23% 57.55% +0.32%
- Complexity 10792 10941 +149
=============================================
Files 1429 1442 +13
Lines 58013 58285 +272
Branches 6729 6773 +44
=============================================
+ Hits 33202 33548 +346
+ Misses 22799 22714 -85
- Partials 2012 2023 +11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
At today's meeting we decided that we don't want to overload the term "duplicate" and will use a very wordy, but descriptive config param: |
| new GroupByFilter<>( | ||
| GroupBySameRoutesAndStops::new, | ||
| List.of( | ||
| new SortingFilter(generalizedCostComparator()), |
There was a problem hiding this comment.
Do you want to keep the lowest cost or the earliest departure?
There was a problem hiding this comment.
I want to keep the earliest departure.
There was a problem hiding this comment.
I think this should be the earliest itinerary for a depart-after search, and the latest for a arrive-by search?
There was a problem hiding this comment.
Could you give me a hint how to achieve that?
There was a problem hiding this comment.
Should I be passing the arriveBy flag through to the chain and then the the ListSection to head or tail respectively?
There was a problem hiding this comment.
I this this would work: new GroupByFilter<>(, new SortingFilter(SortOrderComparator.comparator(sortOrder)) .... Strictly, this will sort street itineraries by them selves - but I guess we do not care in this case, so it is ok.
Can you move the new GroupByFilter<>(...) into a builder method as well, like the buildGroupByTripIdAndDistanceFilters()?
There was a problem hiding this comment.
This is still sorting on generalized cost.
There was a problem hiding this comment.
Sorry, now it's really fixed.
Co-authored-by: Thomas Gran <t2gran@gmail.com>
|
Is it possible to expose this parameter in the GraphQL APIs? |
Summary
Adds a filter that removes itineraries from the result set if they are found to be using the same stops/stations and routes but at different times. This is useful if you don't care so much about "best" results but want to show a greater variety.
I'm a little unsure about the name of the config param:
removeTimeShiftedDuplicates. Does anyone have a better idea?Configuration example
router-config.json
Issue
Closes #4274
Unit tests
Unit and module tests added.
Documentation
Added.