Skip to content

Conversation

AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Jul 30, 2025

Purpose

The root parent was not included in the search.

Proposal

When searching for documents, the root parent document is now included in the search results if it matches the search query.

@AntoLC AntoLC self-assigned this Jul 30, 2025
@AntoLC AntoLC added bug Something isn't working frontend labels Jul 30, 2025
@AntoLC AntoLC force-pushed the fix/include-top-parent-search branch from 7613e6b to e527f91 Compare July 30, 2025 10:34
@AntoLC AntoLC requested review from lunika and Ovgodd July 30, 2025 10:35
@AntoLC AntoLC linked an issue Jul 30, 2025 that may be closed by this pull request
Copy link
Collaborator

@Ovgodd Ovgodd left a comment

Choose a reason for hiding this comment

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

I add just a little suggestion,

otherwise LGTM

const subDocs = subDocsData?.pages.flatMap((page) => page.results) || [];

if (
treeContext?.root &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I may suggest, wrapping this condition in a variable could improve readability, little exemple :

const rootDoc = treeContext?.root;
const shouldIncludeRootInResults =
!!rootDoc && rootDoc.title?.toLowerCase().includes(search.toLowerCase());

Suggested change
treeContext?.root &&
if (shouldIncludeRootInResults) {
subDocs.unshift(rootDoc);
}

When searching for documents, the root parent
document is now included in the search
results if it matches the search query.
@AntoLC AntoLC force-pushed the fix/include-top-parent-search branch from e527f91 to 30dfea7 Compare July 30, 2025 12:56
@AntoLC AntoLC requested a review from Ovgodd July 30, 2025 12:56
@AntoLC AntoLC merged commit 30dfea7 into main Jul 30, 2025
20 of 21 checks passed
@AntoLC AntoLC deleted the fix/include-top-parent-search branch July 30, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Search does not include root parent
3 participants