-
Notifications
You must be signed in to change notification settings - Fork 0
β‘ Bolt: Optimized document metadata fetching #84
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -125,6 +125,12 @@ def search( | |||||||||||||||||||||
| bool_query = Q("bool", must=[]) | ||||||||||||||||||||||
| condition["kb_id"] = knowledgebase_ids | ||||||||||||||||||||||
| for k, v in condition.items(): | ||||||||||||||||||||||
| if k == "id": | ||||||||||||||||||||||
| if isinstance(v, list): | ||||||||||||||||||||||
| bool_query.filter.append(Q("ids", values=v)) | ||||||||||||||||||||||
| elif isinstance(v, str): | ||||||||||||||||||||||
| bool_query.filter.append(Q("ids", values=[v])) | ||||||||||||||||||||||
| continue | ||||||||||||||||||||||
|
Comment on lines
+129
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Missing empty list check for Prompt for AI agents
Suggested change
|
||||||||||||||||||||||
| if k == "available_int": | ||||||||||||||||||||||
| if v == 0: | ||||||||||||||||||||||
| bool_query.filter.append(Q("range", available_int={"lt": 1})) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -154,6 +154,12 @@ def search( | |||||||||||||||||||||||||||||
| bqry = Q("bool", must=[]) | ||||||||||||||||||||||||||||||
| condition["kb_id"] = knowledgebaseIds | ||||||||||||||||||||||||||||||
| for k, v in condition.items(): | ||||||||||||||||||||||||||||||
| if k == "id": | ||||||||||||||||||||||||||||||
| if isinstance(v, list): | ||||||||||||||||||||||||||||||
| bqry.filter.append(Q("ids", values=v)) | ||||||||||||||||||||||||||||||
| elif isinstance(v, str): | ||||||||||||||||||||||||||||||
| bqry.filter.append(Q("ids", values=[v])) | ||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||
|
Comment on lines
+157
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Missing falsy value check for 'id' condition. If Prompt for AI agents
Suggested change
|
||||||||||||||||||||||||||||||
| if k == "available_int": | ||||||||||||||||||||||||||||||
| if v == 0: | ||||||||||||||||||||||||||||||
| bqry.filter.append(Q("range", available_int={"lt": 1})) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
P2: Guard the metadata lookup when there are no page results; an empty doc_ids list triggers a full KB metadata fetch in DocMetadataService and negates the performance optimization on empty pages.
Prompt for AI agents