I ended up not using edgengrams.
I created an analyzer with the standard
tokenizer, and standard
and lowercase
filters. This is virtually identical to the standard
analyser, but does not have any stopwords filter (we are searching for names after all, and there might be someone called The
or An
etc).
I then set the above analyzer as the index_analyzer
and simple
as the search_analyzer
. Using this setup with a match_phrase_prefix
query worked really well.
This is the custom analyser I used (called autocomplete and expressed in PHP):
'autocomplete' => array(
'tokenizer' => 'standard',
'filter' => array('standard', 'lowercase')
),