Hi I need help I have mapping like this
fos_elastica:
clients:
default: %elastica_client%
indexes:
website:
settings:
index:
analysis:
analyzer:
partial_name:
type: custom
tokenizer: standard
filter: [standard, lowercase, ngram_name]
full_name:
type: custom
tokenizer: standard
filter: [standard, lowercase]
filter:
ngram_name:
type: "edgeNGram"
min_gram: 1
max_gram: 10
client: default
finder: ~
types:
profile:
mappings:
username: {type: string, index_analyzer: partial_name, search_analyzer: full_name }
email: {type: string,index: not_analyzed}
first_name: {type: string, index_analyzer: partial_name, search_analyzer: full_name }
last_name: {type: string, index_analyzer: partial_name, search_analyzer: full_name }
full_name_first_last: {type: string, index_analyzer: partial_name, search_analyzer: partial_name }
description: {type: string,index: not_analyzed}
country_id: {type: integer}
industry_id: {type: integer}
category_id:
persistence:
driver: orm
model: CoreBundle\Entity\Profile
listener:
is_indexable_callback: isEnabled
provider:
query_builder_method: findByIsEnabledQueryBuilder
finder: ~
elastica_to_model_transformer:
ignore_missing: true
So the problem is when I search some string that exist for example:
There is Full name: Michael Smith
and when I search like this: $res = $finder->find('Mich*');
It gives me result but I need to make bool query which doesn't work for me, here is example:
$finder = $this->container->get('fos_elastica.finder.website.profile');
$boolQuery = new Bool();
$fieldQuery = new Match();
$fieldQuery->setFieldQuery('username', $user->getUsername());
$boolQuery->addMustNot($fieldQuery);
if(strlen($keyword) > 2){
// Match content by keyword
$fieldQuery = new Match();
$fieldQuery->setFieldQuery('full_name_first_last', 'Mich*');
$boolQuery->addMust($fieldQuery);
}
$result = $finder->find($boolQuery);
This doesn't return nothing for me , can anybody help me what can be problem here?
Thanks