Skip to content

Conversation

@thisisjofrank
Copy link
Collaborator

@thisisjofrank thisisjofrank commented Sep 4, 2025

point site at new datasource in orama, because old one does not seem to be uploading

@thisisjofrank thisisjofrank marked this pull request as ready for review September 4, 2025 17:13
@thisisjofrank thisisjofrank changed the title a messy fix that will do for now fix broken urls at source rather than in the indexer Sep 4, 2025
Copy link
Contributor

@josh-collinsworth josh-collinsworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good at a quick read; confirmed it solves the problem in the browser. I'm a little nervous about edge cases we might be missing, since we're doing a lot of string manipulation here, but maybe the input is more predictable than I think. (Or, maybe we can fix those as we go, since they seem less damaging than the current state of things anyway.)

<a
href="${this.escapeHtml(this.formatUrl(hit.document.url, hit))}"
href="${
this.escapeHtml(hit.document.url || hit.document.path || "#")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: we should have a better fallback than href="#"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe homepage? I wasn't sure what the best option was

// Remove any trailing or leading hashes, pipes, or other separators
cleaned = cleaned.replace(/^[#\|\-\s]+|[#\|\-\s]+$/g, "");
// Remove any trailing or leading hashes
cleaned = cleaned.replace(/^#+|#+$/g, "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we certain hashes are the only characters we have to worry about? I only ask because quite a few others were present in the original version.

search.client.ts Outdated
Comment on lines 476 to 478
.replace(/\s*Jump\s+to\s+heading\s*/gi, "")
.replace(/\s*#Jump-to-heading\s*/gi, "")
.replace(/\s*-Jump-to-heading\s*/gi, "")
.replace(/Jump\s+to\s+heading#?/gi, "")
.replace(/#Jump-to-heading/gi, "")
.replace(/-Jump-to-heading/gi, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we could consolidate these. I'm pretty sure this would work, if we're just accounting for any combination of spaces, dashes, and/or hashes before or after the string.

.replace(/[\s#-]*jump to heading[\s#-]*/gi, "")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh he's good! Have updated

@thisisjofrank
Copy link
Collaborator Author

Looks good at a quick read; confirmed it solves the problem in the browser. I'm a little nervous about edge cases we might be missing, since we're doing a lot of string manipulation here, but maybe the input is more predictable than I think. (Or, maybe we can fix those as we go, since they seem less damaging than the current state of things anyway.)

Yeah, my thinking was to remove complication as much as possible, because i think it might have hidden the issue (tho im not entirely sure it was, because the weird issue with the index not actually uploading requiring the update to a brand new datasource)

@thisisjofrank thisisjofrank merged commit 3474f35 into main Sep 4, 2025
4 checks passed
@thisisjofrank thisisjofrank deleted the search-results branch September 4, 2025 20:30
oscarotero pushed a commit to oscarotero/docs that referenced this pull request Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants