2
votes

I'm just asking to check if I'm doing things the right way. I want to add advanced search capabilities to my django app, and I started to test Haystack with SOLR as backend.

As I do really need partial matches, I've modified my schema.xml so the text field defined by haystack is of type nGram, like this:

    <field name="text" type="ngram" indexed="true" stored="true" multiValued="false" />

Partial matches are now working with the default view included in haystack, so for a Model called John, if I look for "Joh" it's found, as it is "ohn" or any 3 letters combination.

Is this the right way? Why isn't the text field of ngram type by default, because of performance issues?

thanks a lot!

1

1 Answers

0
votes

See this and this. I'm not sure how it responds in terms of preformance, but you can achieve the partial match behavior, also using ngrams, without having to touch your solr schema. Just define your index's text fields as EdgeNgramField.