Fix search indexing with Whoosh 2.7.

Review Request #7354 — Created May 28, 2015 and submitted

Information

Review Board
release-2.0.x
b91415f...

Reviewers

Our search index tried to store a user's group membership using a
MultiValueField. There's nothing in the Haystack docs that indicates
that we can't do this, and in fact, it's totally fine to do this -- IF
the field is meant to be indexed and not just stored along with the rest
of the data. However, if you turn off indexing, it's only allowed to be
a list of numeric IDs, for some reason. At least, that's the case with
Whoosh.

Previously, Whoosh didn't seem to mind this, but as of Whoosh 2.7, it
gets very upset.

So instead, we're now storing as a CharField, flattening the list into a
string, and splitting again in the template. This mimics what Haystack
was already doing, but in a way that should work everywhere.

Successfully indexed and searched using Whoosh 2.5 and Whoosh 2.7.

Unit tests pass on both.

reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/search_indexes.py
    
    Ignored Files:
        reviewboard/templates/search/_user.html
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/search_indexes.py
    
    Ignored Files:
        reviewboard/templates/search/_user.html
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (f7d4697)
Loading...