I would like to use " Phrase Suggester
<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html>
 
". I've got a problem. When typing "johni depp",it returns several results
in this order:
john depp
johnny depp
joann depp
johnn depp
How can I sort the suggestions using json so that the first result is
"johnny depp"?I've tried doing this with a phonetic indexer, but without
success.
This is my configuration:
Query :
{  "query": {    "multi_match": {      "query": "johni depp",      "fields":
[        "fullName.word"      ],      "operator": "and"    }  },  "suggest":
{    "text": "johni depp",    "film": {      "phrase": {        "analyzer":
"whitespace-fullName",        "field": "fullName.whitespace",        "size":
5,        "real_word_error_likelihood": 0.95,        "max_errors": 0.5,       
"gram_size": 2      }    }  },  "from": 0,  "size": 1,  "sort": [], 
"facets": []}
Indexer (I use Elastica, but it's same thing):
$elasticaIndex-&gt;create(              array(                 
'number_of_shards'   =&gt; 4,                  'number_of_replicas' =&gt; 1,    
             
'analysis'           =&gt; array(                      'analyzer' =&gt;
array(                          'autocomplete-index-fullName'  =&gt; array(     
                        
'tokenizer' =&gt; 'standard',                              'filter'    =&gt;
'asciifolding, lowercase, edgeNGram'                          ),                
         
'autocomplete-search-fullName' =&gt; array(                             
'tokenizer' =&gt; 'standard',                              'filter'    =&gt;
'asciifolding, lowercase'                          ),                         
'word-fullName'                =&gt; array(                             
'tokenizer' =&gt; 'keyword',                              'filter'    =&gt;
'lowercase'                          ),                         
'whitespace-fullName'          =&gt; array(                             
'tokenizer' =&gt; 'whitespace',                              'filter'   
=&gt; 'lowercase'                          ),                      ),           
          
'filter'   =&gt; array(                          'edgeNGram' =&gt; array(       
                      
'type'     =&gt; 'edgeNGram',                              'min_gram' =&gt;
1,                              'max_gram' =&gt; 15                         
)                      )                  )              ),             
false);
Mapping :
$mapping-&gt;setProperties(        array(            'fullName' =&gt;
array('type'   =&gt; 'string',                                'fields' =&gt;
array(                                    'autocomplete' =&gt; array(           
                            
'type'            =&gt; 'string',                                       
'index_analyzer'  =&gt; 'autocomplete-index-fullName',                          
             
'search_analyzer' =&gt; 'autocomplete-search-fullName'                          
         
),                                    'word'         =&gt; array(               
                        
'type'            =&gt; 'string',                                       
'analyzer'  =&gt; 'word-fullName'                                    ),         
                          
'whitespace'   =&gt; array(                                        'type'       
    
=&gt; 'string',                                        'analyzer'  =&gt;
'whitespace-fullName'                                    ),                     
          
)),        ));
Examples of referenced values:
John Cleese
John Gemberling
Johnny Hallyday
Johnny Depp
Joann Sfar
Joanna Rytel
Samuel Johnson
Johnson Traoré
Thanks in advance.




--
View this message in context: 
http://elasticsearch-users.115913.n3.nabble.com/Elasticsearch-phrase-suggester-tp4053844.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1397059055130-4053844.post%40n3.nabble.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to