您好,我正在尝试通过FosElasticaBundle获取查询结果,我
如果没有可能不突出显示这些单词,那么找不到用于过滤常见单词(和(或))的有效示例。到目前为止我的奋斗:
$searchForm = $this->createForm(SearchFormType::class, null);
$searchForm->handleRequest($request);
$matchQuery = new \Elastica\Query\Match();
$matchQuery->setField('_all', $queryString);
$searchQuery = new \Elastica\Query();
$searchQuery->setQuery($matchQuery);
$searchQuery->setHighlight(array(
"fields" => array(
"title" => new \stdClass(),
"content" => new \stdClass()
),
'pre_tags' => [
'<strong>'
],
'post_tags' => [
'</strong>'
],
'number_of_fragments' => [
'0'
]
));
提前致谢 ;)
最佳答案
您要忽略(和或)还是在搜索中没有值(value)?
如果是这种情况,您可能要在Elasticsearch索引上使用停用词。
这是引用。
https://www.elastic.co/guide/en/elasticsearch/guide/current/using-stopwords.html
关于elasticsearch - Fos Elastica从搜索查询中删除常用词(或其他)。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39973000/