Question

I'm using haystack and whoosh to do provide search on my site, however, I need to index words that have square brackets or other characters in the middle of words ("fo[oba]r" for example) - is there a way to have either the index ignore these characters (and index as "foobar"), or allow for them when searching? Can I accomplish this with Whoosh, or would another backend be better?

Was it helpful?

Solution

There's a few ways you could implement this - basically what you want to do is strip the square brackets in your indexed content, and one way you could do this is to write a method on your model to return the modified content for the field you're indexing, and then use this in your search template.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top