Skip to content

[BUGFIX] Fixed crashes on Search#924

Merged
augustjohnson merged 1 commit into
open5e:stagingfrom
calumbell:922/search-500s
May 19, 2026
Merged

[BUGFIX] Fixed crashes on Search#924
augustjohnson merged 1 commit into
open5e:stagingfrom
calumbell:922/search-500s

Conversation

@calumbell
Copy link
Copy Markdown
Contributor

@calumbell calumbell commented May 19, 2026

Description

This PR fixes a bug that was causing the v2 Search to crash when certain terms were searched for (see issue #922).

The bug appears to be in the code that adds additional contextually relevant fields to search results. adding a spell's school and level when the search returns a spell, for example.

The Document model's search_result_extra_fields method instructed the serializer to add the "school" field to any search result that inherits from the FromDocument model. I can only assume that this bug only triggered on some search terms and not others was because in many cases the search_result_extra_fields is overloaded in the Class that inherited from the FromDocument abstract model, obscuring the bug. A quick peak at the error messages/stack trace reveals that it was the Item model which was giving the API issues, and investigating the Item model it looks like this method is not defined there. Surprise surprise.

This would normally be the type of bug that pytest would catch, but it looks like the Search is a blind-spot in our testing suite. Would be well worth adding this in!

Related Issue

Closes #922

How was this tested?

  • pytest (all tests green)
  • Spot checked on local Django development server
  • All CI tests passing

Copy link
Copy Markdown
Collaborator

@augustjohnson augustjohnson left a comment

Choose a reason for hiding this comment

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

Makes sense, no concerns.

@augustjohnson augustjohnson merged commit c5ef25d into open5e:staging May 19, 2026
3 checks passed
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.

[BUG] Search is crashing (500 res) when certain common queries are searched

2 participants