- Add search with +

- Fix ArcadiaLink
This commit is contained in:
Vincent BRIDIER 2019-12-05 17:25:38 +01:00
parent 79f82a470a
commit bad1067b32
3 changed files with 50 additions and 3 deletions

View file

@ -346,6 +346,54 @@ class MediaController extends Controller
];
break;
}
}else if (strpos($search, '+') !== false){
$search = strtolower(trim($filters->search->value));
$tmpSearch = explode('+', $search);
$mustLib = [];
foreach ($tmpSearch as $search) {
array_push($mustLib, [
'wildcard' => [
'libelle.keyword' => [
'wildcard' => "*$search*",
'boost' => 1.0
]
]
]);
}
$mustArt = [];
foreach ($tmpSearch as $search) {
array_push($mustArt, [
'wildcard' => [
'articles.libCcial.keyword' => [
'wildcard' => "*$search*",
'boost' => 1.0
]
]
]);
}
$tmpFilters = [
[
'bool' => [
'should' => [
[
'bool' => [
'must' => $mustLib
]
],
[
'bool' => [
'must' => $mustArt
]
]
]
]
]
];
//dd($tmpFilters);exit;
}else{
$tmpFilters = [
[

View file

@ -113,7 +113,7 @@ trait ArcadiaLink {
$cleRef = $root->appendChild( $dom->createElement('cle_Referentiel'));
foreach ($refKey as $k) {
$cleRef->appendChild( $dom->createElement('id'))->appendChild($dom->createCDATASection( "$k->id"));
$cleRef->appendChild( $dom->createElement('id'))->appendChild($dom->createCDATASection( "$k->noArt"));
}
$root->appendChild( $dom->createElement('libExtension'))->appendChild($dom->createCDATASection( "$media->extension"));

View file

@ -51,8 +51,7 @@ class Media extends Model
],
'tokenizer' => 'whitespace',
'filter' => [
'lowercase',
'word_delimiter',
'word_delimiter'
],
],
],