我用同义词实现搜索 . 这些是使用同义词进行搜索的更改 . 这是我在索引中的设置 . 我使用了泡泡搜索扩展并修改了该代码 .
$indexSettings['analysis']['analyzer'] = array(
'std' => array(
'tokenizer' => 'standard',
'char_filter' => 'html_strip', // strip html tags
'filter' => array('standard', 'elision', 'asciifolding', 'lowercase', 'stop', 'length'),
),
'keyword' => array(
'tokenizer' => 'keyword',
'filter' => array('asciifolding', 'lowercase'),
),
'keyword_prefix' => array(
'tokenizer' => 'keyword',
'filter' => array('asciifolding', 'lowercase', 'edge_ngram_front'),
),
'text_prefix' => array(
'tokenizer' => 'standard',
'char_filter' => 'html_strip', // strip html tags
'filter' => array('standard', 'elision', 'asciifolding', 'lowercase', 'stop', 'edge_ngram_front'),
),
'text_suffix' => array(
'tokenizer' => 'standard',
'char_filter' => 'html_strip', // strip html tags
'filter' => array('standard', 'elision', 'asciifolding', 'lowercase', 'stop', 'edge_ngram_back'),
),
/*This is my analyzer for synonym*/
'synonym' => array(
'tokenizer' => 'standard',
'type' => 'custom',
// 'char_filter' => 'html_strip', // strip html tags
'filter' => array('synonym','standard', 'elision', 'asciifolding', 'lowercase', 'stop',"kstem", "length" )
),
);
$indexSettings['analysis']['filter'] = array(
'edge_ngram_front' => array(
'type' => 'edgeNGram',
'min_gram' => 2,
'max_gram' => 10,
'side' => 'front',
),
'edge_ngram_back' => array(
'type' => 'edgeNGram',
'min_gram' => 2,
'max_gram' => 10,
'side' => 'back',
),
'stop' => array(
'type' => 'stop',
'stopwords' => '_none_',
),
'length' => array(
'type' => 'length',
'min' => 2,
),
/*This is filter for synonym */
'synonym' => array(
'type' => 'synonym',
'expand' => true,
'synonyms_path' => 'synonyms.txt',
),
);
$properties[$key]['analyzer'] = 'synonym';
我得到的结果,但没有达标 . 例如lkjhgf => arylacetamide deacetylase like 3如果我搜索lkjhgf那么它将给出芳基乙酰胺脱乙酰酶的结果,如1芳基乙酰胺脱乙酰酶如2芳基乙酰胺脱乙酰酶如3芳基乙酰胺脱乙酰酶如4
I want exact match and my fuzzy login is also disabled.