Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose:
This PR implements a strategy to performantly find a matching URL for a Webpage that is agnostic of not only its scheme (which already was implemented), but also its parameters (
?
) and anchors (#
). Originally, a regex approach via Postgres was attempted that proved too convoluted and complex. Instead, we've ended with a compromise: a speedy scope that churns out best-guess matches for the URL in question, then a slow class method that refines those guesses and provides an exact match. A previous PR featured a similar implementation, but lacked the best-guess scope - this meant it had to load and loop through every Webpage in the system until it found an exact match.To better explain why we can't just use the buest-guess scope, consider the following three URLs:
https://hiring.careerbuilder.com/contact-us
https://hiring.careerbuilder.com/contact-us-today
https://hiring.careerbuilder.com/contact-me
If the search term was
hiring.careerbuilder.com/contact-us
, the scope would properly excludecontact-me
. However, because the scope will match any character on either side of the search term, the first two results are returned in the record set. This is why the class method exists - to refine these results.JIRA:
https://cb-content-enablement.atlassian.net/browse/COR-785
Steps to Take On Prod
N/A
Changes:
Changes to setup
Architectural changes
Migrations
Library changes
Side effects
Screenshots
Before
N/A
After
N/A
QA Links:
How to Verify These Changes
Specific pages to visit
Steps to take
?params
and#anchors
.Responsive considerations
Relevant PRs/Dependencies:
N/A
Additional Information
N/A