Skip to content
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

feat: search more than only the notebook title #17379

Merged
merged 32 commits into from
Sep 13, 2023

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Sep 11, 2023

Extends notebook search to cover all text content in the notebook

  • implement tiptap/prosemirror text serializers for all custom nodes
  • use those to construct a text only representation of the document
  • store that alongside the notebook
  • search that when searching notebooks
    • uses full text search so a notebook containing the word "ponies" can be found by searching "pony"

## TODO

  • some tests

@pauldambra pauldambra requested a review from daibhin September 11, 2023 21:32
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

frontend/src/scenes/notebooks/Notebook/notebookLogic.ts Outdated Show resolved Hide resolved
posthog/models/notebook/notebook.py Show resolved Hide resolved
frontend/src/scenes/notebooks/Notebook/Editor.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@daibhin daibhin left a comment

Choose a reason for hiding this comment

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

Just left a couple more comments but this seems much better. Feels really close now❗

@@ -75,6 +75,25 @@ export const NotebookNodeReplayTimestamp = Node.create({
group: 'inline',
atom: true,

serializedText:
() =>
(attrs: { playbackTime: number }): string => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the types not get carried over here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed that there was already an interface, so can use that... but (I think) there's no type detection here because we're not wrapped in the create widget function that carries the type

posthog/api/notebook.py Outdated Show resolved Hide resolved
posthog/api/notebook.py Outdated Show resolved Hide resolved
posthog/api/test/notebooks/test_notebook_filtering.py Outdated Show resolved Hide resolved
@pauldambra pauldambra requested a review from daibhin September 13, 2023 11:59
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

@daibhin daibhin left a comment

Choose a reason for hiding this comment

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

👍

@@ -79,6 +79,10 @@ export const NotebookNodeImage = createPostHogWidgetNode<NotebookNodeImageAttrib
nodeType: NotebookNodeType.Image,
title: 'Image',
Component,
serializedText: (attrs) => {
// TODO file is null when this runs... should it be?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the right thing to do here might be to set the title to be the name of the file when updateAttributes is called after uploading the file, and then the serialized text could just be attrs.title. That's for a follow up though

@pauldambra pauldambra enabled auto-merge (squash) September 13, 2023 15:55
@pauldambra pauldambra disabled auto-merge September 13, 2023 16:16
@pauldambra pauldambra dismissed benjackwhite’s stale review September 13, 2023 16:16

I think it is out of date

@pauldambra pauldambra merged commit 45a206c into master Sep 13, 2023
66 checks passed
@pauldambra pauldambra deleted the feat/store-text-alongside-notebook branch September 13, 2023 16:16
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.

4 participants