0
我试图让ES QueryString匹配包含“and”的搜索词,但我迄今试过的所有内容(尝试不同的分析仪,令牌仪,过滤器)没有工作。在MySQL方面,我要的是:ElasticSearch/Elastica:搜索包含“and”或其他停用词的确切词语
WHERE field LIKE '%abbot and costello%'
我已经试过各种配置,这是我目前使用的是什么(因为它“方丈”匹配略有改善(与尾随的空间),但仍然没有它匹配任何东西“和”:
$eI->create(array(
'analysis' => array(
'analyzer' => array(
'indexAnalyzer' => array(
'type' => 'custom',
'tokenizer' => 'SQLedgeNGram',
'filter' => array(
'lowercase',
),
),
'searchAnalyzer' => array(
'type' => 'custom',
'tokenizer' => 'SQLedgeNGram',
'filter' => array(
'lowercase',
),
)
),
'tokenizer' => array(
'SQLedgeNGram' => array(
'type' => 'edgeNGram',
'min_gram' => 2,
'max_gram' => 35,
'side' => 'front'
),
'standardNoStop' => array(
'type' => 'standard',
'stopwords' => ''
)
)
)
), true
);
这里是我的测试用例字段值:
Abbott and Costello - Funniest Routines, Vol.
尝试各种分析仪,我似乎无法得到它匹配任何包含“和“
个结果:
searching [abbot]
@ searchAnalyzer total results: 1
@ standard total results: 1
@ simple total results: 1
@ whitespace total results: 1
@ keyword total results: 1
searching [abbot ]
@ searchAnalyzer total results: 1
@ standard total results: 1
@ simple total results: 1
@ whitespace total results: 1
@ keyword total results: 1
searching [abbot and c]
searchAnalyzer total results: 0
standard total results: 0
simple total results: 0
whitespace total results: 0
keyword total results: 0
searching [abbot and cost]
searchAnalyzer total results: 0
standard total results: 0
simple total results: 0
whitespace total results: 0
keyword total results: 0
searching [abbot and costello]
searchAnalyzer total results: 0
standard total results: 0
simple total results: 0
whitespace total results: 0
keyword total results: 0
searching [abbot costello]
searchAnalyzer total results: 0
standard total results: 0
simple total results: 0
whitespace total results: 0
keyword total results: 0
我知道这是一个简单的答案,但感谢您花时间指出问题,这使我很悲伤..检查了一切,但最明显的:( – Eva