$finder = $this->container->get('fos_elastica.finder.site.search');
$boolQuery_term = new \Elastica_Query_Bool();
$term = new \Elastica_Query_Terms();
$term->setTerms('CmpCode', array(1,2,3));
$boolQuery_term->addMust($term);
Path: site/search/_search
Method: GET
{"query":{"bool":{"must":[{"bool":{"must":[{"terms":{"CmpCode":[1,2,3]}}]}}]}},"from":0,"size":25}
Time: 3.05 ms
查询不返回结果。
配置:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
site:
settings:
index:
analysis:
analyzer:
my_analyzer:
type: snowball
tokenizer: my_tokinizer
filter : [lowercase, my_ngram]
filter:
my_ngram:
type: "nGram"
min_gram: 3
max_gram: 50
tokenizer:
my_tokinizer:
type: "nGram"
min_gram: 3
max_gram: 50
types:
search:
mappings:
cmpName:
CitName:
CatName:
cmpAddress:
cmpSite:
cmpEmail:
cmpCeo:
cmpCode: {type: integer}
cmpVat:
cmpAddress:
cmpEmp: {type: integer}
cmpReturn: {type: integer}
cmpReturnFrom:
cmpReturnTill:
persistence:
identifier: cmpId
driver: orm
model: Catalog\WebBundle\Entity\ComCompany
provider:
finder:
查询也不返回结果,在db存在的记录中包含id" 1
,2
,3
",哪里可能有问题?
哪里可能有问题?