I have a UserProfile Model with 35 fields (Char,Int,Bool,Dec,M2M,FK). As part of the search view functionality, one of the fields requires full-text searching while the remaining 34 fields will be used to provide 'advanced search filtering' (using: __gte,__lte,__exact, __in, __startswith). A 'search' query may use between 5-35 fields as the search view criteria.
I'm using haystack to build a SearchIndex and currently have all 35 fields added, but this seems ineffective since I am bypassing the django ORM (?).
an answer from Filter Django Haystack results like QuerySet? suggests that I could just store the single full-text search field in the SearchIndex and combine the SearchQuerySet with django's QuerySet for the remaining 34 filter fields. Would I then use db_index=True on some or all of these fields in my django model? Would using this 2-stage query merge approach scale well to thousands of results?
Since my UserProfile model could grow to 300K-2M entries, I am trying to understand how best to index this Model. Being new to db indexing and searching, I am looking for any insight on how best to optimize my database.