Skip to content

Conversation

@habrahamsson-skanetrafiken
Copy link
Contributor

Summary

This PR adds support for a complimentary search that is run in addition to the regular raptor search. This new search extends the search result with "direct" transit paths, that is paths with a single transit leg. In contrast to raptor it returns paths even if they are not optimal according to any criteria. It can be configured to run with access/egress or only for stop to stop searches.

The main use case for this additional search is to show slower journeys such as regional trains, slower buses etc that are not included in the main raptor search. See the highlighted journey in the example below, using an ordinary raptor search it will never show up in a search results because the previous journey is better in all criteria.

direct-transit1

Issue

Closes #6977. See issue for detailed use cases.

Implementation

The search is implemented in the raptor module and runs on the raptor transit data in order to take advantage of the cost calculation and the itinerary mapping.

Naming

The name RelaxedLimitedTransferSearch was chosen together with @t2gran. "Relaxed" comes from the fact that the search uses a relax function to decide what trips are included. "LimitedTransfer" is because Entur is interested in extending this in the future to work with not only direct transit, but also specific single transfer journeys like stay-seated transfers and transfers to replacement buses.

Configuration

This feature is currently not exposed through any api and is configurable through router-config.json. It takes three configuration parameters:

costRelaxFunction
In order to exclude really bad paths there is a cost function that is used to reject paths that are much more expensive than the cheapest path.

extraAccessEgressCostFactor
When using this search in an area with lots of transit options such as a city center it can produce too many results where one walks for a while, takes a short transit and then walks to the destination. Having too many of these alternatives will not be useful to travelers. They can be limited using an extra cost on accesses and egresses that is specific for this search.

disableAccessEgress
The search can also be configured to not use access/egress at all. In that case it will only be used when searching to and from a stop or station.

Bumping the serialization version id

Yes, updating the route request.

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken requested a review from a team as a code owner December 18, 2025 08:41
@habrahamsson-skanetrafiken habrahamsson-skanetrafiken added !New Feature A functional feature targeting the end user. +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR labels Dec 18, 2025
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 68.34532% with 88 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.08%. Comparing base (1fc2003) to head (4588ff4).
⚠️ Report is 3 commits behind head on dev-2.x.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...dalone/config/routerequest/RouteRequestConfig.java 26.31% 27 Missing and 1 partial ⚠️
.../preference/RelaxedLimitedTransferPreferences.java 61.36% 13 Missing and 4 partials ⚠️
...dlimitedtransfer/RelaxedLimitedTransferSearch.java 82.41% 6 Missing and 10 partials ⚠️
...tor/api/request/RelaxedLimitedTransferRequest.java 76.74% 7 Missing and 3 partials ⚠️
...oradapter/transit/mappers/RaptorRequestMapper.java 12.50% 6 Missing and 1 partial ⚠️
...anner/raptor/service/RangeRaptorDynamicSearch.java 37.50% 3 Missing and 2 partials ⚠️
...opentripplanner/raptor/configure/RaptorConfig.java 89.47% 0 Missing and 2 partials ⚠️
...ing/api/request/preference/TransitPreferences.java 90.00% 0 Missing and 1 partial ⚠️
...anner/raptor/api/request/MultiCriteriaRequest.java 91.66% 0 Missing and 1 partial ⚠️
...rangeraptor/transit/AccessEgressWithExtraCost.java 80.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #7145      +/-   ##
=============================================
- Coverage      72.09%   72.08%   -0.02%     
- Complexity     20696    20739      +43     
=============================================
  Files           2244     2248       +4     
  Lines          83899    84173     +274     
  Branches        8347     8377      +30     
=============================================
+ Hits           60489    60673     +184     
- Misses         20483    20546      +63     
- Partials        2927     2954      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR !New Feature A functional feature targeting the end user.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include non-optimal direct transit trips in search result

3 participants