Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

hackathon - search/notebook: basic notebooks query #33170

Merged
merged 2 commits into from
Mar 29, 2022

Conversation

bobheadxi
Copy link
Member

@bobheadxi bobheadxi commented Mar 29, 2022

This is a hackathon project, and is not being merged into main! See https://sourcegraph.com/notebooks/Tm90ZWJvb2s6NTE5

Implements a basic end-to-end query that searches the full "notebook name" (namespace + title) with a simple ILIKE query. The query emulates how normal search works by replacing spaces with wildcards so you can be pretty loose with your query.

Sharing code with enterprise/.../notebooks: we could possibly refactor this so that it lives in the same store as other notebooks stuff, but register it as the handler for the notebook search job from an init function. That said it makes sense, perhaps, to have the DB queries live here so that we can specialize it for search. It would be nice to share the permissions filter at least, however - not sure where this would live.

Stacked on https://github.com/sourcegraph/sourcegraph/pull/33161

Kapture.2022-03-28.at.17.48.03.mp4

@cla-bot cla-bot bot added the cla-signed label Mar 29, 2022
@bobheadxi bobheadxi requested a review from tsenart March 29, 2022 00:50
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Mar 29, 2022

Codenotify: Notifying subscribers in CODENOTIFY files for diff 01e9514...ca26530.

Notify File(s)
@beyang internal/search/job/job.go
internal/search/notebook/notebook.go
internal/search/notebook/store.go
internal/search/notebook/store_copied.go
@camdencheek internal/search/job/job.go
internal/search/notebook/notebook.go
internal/search/notebook/store.go
internal/search/notebook/store_copied.go
@keegancsmith internal/search/job/job.go
internal/search/notebook/notebook.go
internal/search/notebook/store.go
internal/search/notebook/store_copied.go

@bobheadxi bobheadxi changed the title basic notebooks query search/notebook: basic notebooks query Mar 29, 2022
@bobheadxi bobheadxi changed the title search/notebook: basic notebooks query hackathon - search/notebook: basic notebooks query Mar 29, 2022
Base automatically changed from notebooks-search-e2e-basic to notebooks-search March 29, 2022 08:30
@tsenart tsenart force-pushed the notebooks-search-e2e-with-query branch from 3ac1e31 to ca26530 Compare March 29, 2022 10:45
sqlf.Sprintf(
searchNotebooksFmtStr,
notebooksPermissionsCondition(ctx),
sqlf.Sprintf("CONCAT(users.username, orgs.name, notebooks.title) ILIKE %s",
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably doesn't use any indexes because of the CONCAT. Not a biggie for hackday, but in production code it's important.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants