-
Notifications
You must be signed in to change notification settings - Fork 519
Integrate find #1834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Integrate find #1834
Conversation
frontend is now calling the search endpoint
I am adding the path params to the search endpoint. This allows searching in subdocs.
I did a mistake in the env variables file
pagination is no longer supported by Find
handle filtering on sub-docs
I am fixing a bug about dupplicated documents
I update the changelog
I am removing dead code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Integrates Find-powered document search into the Docs UI/API, removing the previous infinite-scroll pagination approach and adding optional path-based scoping for “current doc” searches.
Changes:
- Frontend doc search now calls a dedicated
documents/search/endpoint via a newuseSearchDocshook and removes infinite pagination. - Backend search endpoint proxies to the configured Find indexer, adds optional
pathfiltering, and returns a simplified{count, results}response. - Development environment variables are updated to enable the indexer and store OIDC tokens in session.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchSubPageContent.tsx | Switches “current doc” search to Find-backed useSearchDocs with path scoping. |
| src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx | Removes legacy filter props from search content components (target selection remains). |
| src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx | Replaces infinite query + InView pagination with useSearchDocs. |
| src/frontend/apps/impress/src/features/docs/doc-management/api/useDocs.tsx | Removes title query param support from the list-docs hook params builder. |
| src/frontend/apps/impress/src/features/docs/doc-management/api/searchDocs.tsx | Adds new React Query hook + request param construction for Find search endpoint. |
| src/backend/core/services/search_indexers.py | Extends indexer search call to accept a path filter and forwards it to Find. |
| src/backend/core/api/viewsets.py | Refactors search logic, removes pagination for Find-backed results, and adds path plumbing. |
| src/backend/core/api/serializers.py | Updates search query serializer to drop pagination params and add optional path. |
| env.d/development/common | Enables token storage and enables the indexer in dev env. |
| docs/search.md | Minor wording correction in search configuration docs. |
| CHANGELOG.md | Adds an “integrate Find search” entry under Unreleased. |
Comments suppressed due to low confidence (1)
src/backend/core/api/serializers.py:985
pathis not trimmed, so a value like' 'will pass validation even though it’s effectively blank. To matchqbehavior and avoid confusing/ineffective filters, settrim_whitespace=Trueforpath(and keepallow_blank=False).
q = serializers.CharField(required=True, allow_blank=False, trim_whitespace=True)
path = serializers.CharField(required=False, allow_blank=False)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchSubPageContent.tsx
Outdated
Show resolved
Hide resolved
src/frontend/apps/impress/src/features/docs/doc-management/api/useSearchDocs.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
9759654 to
ac3aac5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (3)
src/backend/core/api/viewsets.py:1267
_search_simplestill returns a paginated response (get_response_for_queryset), while the frontend search hook no longer sends pagination params. If the indexer is not configured,nextwill be non-null and the frontend infinite-query will keep refetching page 1 (duplicates / potential loop). Consider making the fallback path return a non-paginated response consistent with_search(and apply the optionalpathfilter there too).
indexer = get_document_indexer()
if indexer:
return self._search_with_indexer(indexer, request, params=params)
# The indexer is not configured, we fallback on a simple icontains filter by the
# model field 'title'.
return self._search_simple(request, text=params.validated_data["q"])
src/backend/core/api/serializers.py:984
SearchDocumentSerializerremovedpage/page_sizeand addedpath, but there are existing backend tests that assert pagination validation and behavior for/documents/search/(e.g.core/tests/documents/test_api_documents_search.py::test_api_documents_search_paginationand..._invalid_params). These tests will need to be updated/removed, and new assertions should cover thepathfilter behavior.
q = serializers.CharField(required=True, allow_blank=False, trim_whitespace=True)
page_size = serializers.IntegerField(
docs/search.md:22
- The configuration example still references
core.services.search_indexers.FindDocumentIndexer, but there is no such class in the backend (the implemented class isSearchIndexer). Update the docs snippet to use the correct class path so users can enable search successfully.
Add those Django settings to the Docs application to enable the feature.
```shell
SEARCH_INDEXER_CLASS="core.services.search_indexers.FindDocumentIndexer"
SEARCH_INDEXER_COUNTDOWN=10 # Debounce delay in seconds for the indexer calls.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export type DocsParams = { | ||
| page: number; | ||
| q: string; | ||
| target?: DocSearchTarget; | ||
| parentPath?: string; |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new types are named DocsParams/DocsResponse, which are easy to confuse with the existing DocsParams/DocsResponse in useDocs.tsx. Consider renaming them to SearchDocsParams/SearchDocsResponse (or similar) to make imports and error messages unambiguous.
| # Indexer (disabled) | ||
| # SEARCH_INDEXER_CLASS="core.services.search_indexers.SearchIndexer" | ||
| SEARCH_INDEXER_CLASS=core.services.search_indexers.SearchIndexer | ||
| SEARCH_INDEXER_SECRET=find-api-key-for-docs-with-exactly-50-chars-length # Key generated by create_demo in Find app. | ||
| SEARCH_INDEXER_URL="http://find:8000/api/v1.0/documents/index/" | ||
| SEARCH_INDEXER_QUERY_URL="http://find:8000/api/v1.0/documents/search/" | ||
| SEARCH_INDEXER_URL=http://find:8000/api/v1.0/documents/index/ | ||
| SEARCH_INDEXER_QUERY_URL=http://find:8000/api/v1.0/documents/search/ | ||
| SEARCH_INDEXER_QUERY_LIMIT=50 |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is labeled “Indexer (disabled)”, but the PR enables SEARCH_INDEXER_CLASS and related settings. Either update the comment/header to match the new default, or keep these settings commented out and document how to enable Find explicitly to avoid surprising dev setups that don’t run the Find service.
| import { KEY_LIST_DOC } from '@/docs/doc-management'; | ||
| import { DocSearchTarget } from '@/docs/doc-search'; | ||
|
|
||
| import { Doc } from '../types'; | ||
|
|
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useSubDocs.tsx was deleted in this PR, but the doc-management API barrel still exports it (src/frontend/apps/impress/src/features/docs/doc-management/api/index.ts has export * from './useSubDocs';). This will break TypeScript/module resolution for any import from @/docs/doc-management. Remove that export (and optionally export the new search hook instead).
| import { KEY_LIST_DOC } from '@/docs/doc-management'; | |
| import { DocSearchTarget } from '@/docs/doc-search'; | |
| import { Doc } from '../types'; | |
| import { DocSearchTarget } from '@/docs/doc-search'; | |
| import { Doc } from '../types'; | |
| const KEY_LIST_DOC = 'docs'; |
I am fixing various things
I am adding this file containing the variables needed to run test without docker Signed-off-by: charles <[email protected]>
ac3aac5 to
4200948
Compare
I remove DB access Signed-off-by: charles <[email protected]>
I am adding a title_search with all the logic Signed-off-by: charles <[email protected]>
Purpose
integrate Find to Docs
Proposal
useSeachDocshook in charged of calling the search endpoint.pathparams to handle the sub-docs filtering.This does not include new tests.
External contributions
Thank you for your contribution! 🎉
Please ensure the following items are checked before submitting your pull request:
git commit --signoff(DCO compliance)git commit -S)<gitmoji>(type) title description## [Unreleased]section (if noticeable change)