DjangoCon Europe 2023 | Beyond faceted search
Beyond faceted search by Alex Henman https://pretalx.com/djangocon-europe-2023/talk/9QTPXX/
What do you do when faceted search over your data isn’t enough? I’ll demonstrate how to build a powerful search tool over limitlessly related models and their fields.
Full text search and faceted search will get you a long way for most use cases: when your data is largely free text or when you don’t have complex data structures, these will usually be enough.
But what do we do as our datasets get larger, the relations between our tables more complex and when we want to combine text search with filters based on dates, categories or numbers?
To begin, we'll define a simple JSON-based DSL for representing a query and introduce some terminology and structure that will help us along the way.
We’ll express how our models connect to one another and how to search over those relations. We’ll then define which fields should be searchable and write generalisable logic to handle input data for different model fields.
We’ll put it all together into a recursive algorithm which can build a queryset from any valid query represented in our DSL.
But where could we take this next? I’ll outline the simplifications we've made, the performance limitations of this approach and what else lies beyond.
This will largely be an outline of the concepts rather than an in-depth guide to how you can build such a tool. We’ll get into some technical detail building up from the ORM primitives like Q and F objects but we’ll largely avoid getting our hands dirty with the internals of the Django ORM.
You’ll come out of this with a better understanding of how to utilise the flexibility of the Django ORM to build search tools that your users will love.
Date Added: September 19, 2024
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.