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
FEATURE: include tag and category context in search #217
Conversation
Previous to this we just included title/body.. tags and category structure can be very critical for decision making.
(not its responsibility to test)
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.
LGTM 👌
thanks @vinothkannans was thinking about this and there are some N+1s here ... not sure how easy it is to fix though ... its all in a background job and most of the time you are waiting for LLM, but maybe I should fix. |
|
||
if SiteSetting.tagging_enabled | ||
hidden_tags ||= DiscourseTagging.hidden_tag_names | ||
# using map over pluck to avoid n+1 (assuming caller preloading) |
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.
Instead of assuming can we check whether the association is loaded or not? like post.topic.association(:tags).loaded?
. And we can raise an error if it's not loaded.
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.
I think it is the responsibility of Search or SemanticSearch ... but maybe we can raise a warning in case this happens.
|
||
if posts.blank? | ||
{ args: search_args, rows: [], instruction: "nothing was found, expand your search" } | ||
else | ||
format_results(posts, args: search_args) do |post| | ||
{ | ||
category_names = [ | ||
post.topic.category&.parent_category&.name, |
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.
I don't know how the search command is executed in the background. Will it cause n+1 in category and parent_category attributes too?
Previous to this we just included title/body.. tags and category
structure can be very critical for decision making.