Loading front/src/components/OrganizationAutoCompleter.vue +50 −39 Original line number Diff line number Diff line <template> <div> <small>{{ filteredOptions.length }}</small> <v-select @search="handlerSearchOrganisation" placeholder="Rechercher une structure" :options="filteredOptions" :options="options" label="label" v-model="value" :reduce="item => item.id" :dropdown-should-open="dropdownShoultOpen" @input="setSelected" > <template #list-header> Loading Loading @@ -38,6 +41,7 @@ </div> </template> </v-select> </div> </template> <script> Loading Loading @@ -132,7 +136,7 @@ export default { if (this.delay != null) { clearTimeout(this.delay); } this.delay = setTimeout(delayFunction, 1000); this.delay = setTimeout(delayFunction, 300); } }, Loading @@ -143,7 +147,10 @@ export default { * @param vm */ searchOrganization(loading, search, vm) { let closeOpt = this.displayClosed ? '&active=' : '&active=ON' console.log("PRELOADVALUE:", this.preloadedValue); this.$http.get('/organization?l=m&q=' + encodeURI(search)).then( ok => { if (this.preloadedValue == false) { Loading @@ -161,6 +168,10 @@ export default { } ) }, dropdownShouldOpen(VueSelect) { console.log("dropdownShouldOpen"); return VueSelect.close; }, } } </script> No newline at end of file module/Oscar/src/Oscar/Command/OscarOrganizationsSearchCommand.php +7 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ namespace Oscar\Command; use Moment\Moment; use Oscar\Entity\Authentification; use Oscar\Entity\LogActivity; use Oscar\Entity\Organization; use Oscar\Entity\Person; use Oscar\Entity\Role; use Oscar\Service\ConnectorService; Loading Loading @@ -59,8 +60,13 @@ class OscarOrganizationsSearchCommand extends OscarCommandAbstract try { $search = $input->getArgument('search'); $organisations = $organisationService->search($search); /** @var Organization $organisation */ foreach ($organisations as $organisation) { $io->writeln(sprintf('- <bold>[%s]</bold> %s (%s)', $organisation->getId(), (string)$organisation, $organisation->getCode())); $io->writeln(sprintf('- <bold>[%s]</bold> [%s] %s (%s)', $organisation->getId(), $organisation->getShortName(), $organisation->getFullName(), $organisation->getCode())); } } catch (\Exception $e ){ $io->error($e->getMessage() . "\n" . $e->getTraceAsString()); Loading module/Oscar/src/Oscar/Strategy/Search/ActivityElasticSearch.php +3 −2 Original line number Diff line number Diff line Loading @@ -198,12 +198,13 @@ class ActivityElasticSearch implements ActivitySearchStrategy 'numbers^9', 'oscar^9', 'label^7', 'description^7', 'description^2', 'project^5', 'disciplines^5', 'activitytype^2', 'partners^5', 'members^5'] 'members^5'], "fuzziness"=> "auto" ] ] ] Loading module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php +80 −53 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use Oscar\Connector\ConnectorRepport; use Oscar\Entity\ActivityOrganization; use Oscar\Entity\Organization; use Oscar\Entity\OrganizationPerson; use Oscar\Exception\OscarException; class OrganizationElasticSearch implements OrganizationSearchStrategy { Loading Loading @@ -63,6 +64,8 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy ->setHosts($this->getHosts()) ->build(); } return $this->elasticSearchClient; } Loading Loading @@ -173,11 +176,7 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy 'country' => $organization->getCountry(), 'zipcode' => $organization->getZipCode(), 'description' => $organization->getDescription(), // 'address1' => $organization->getStreet1(), // 'address2' => $organization->getStreet2(), // 'address3' => $organization->getStreet3(), 'siret' => $organization->getSiret(), 'country' => $organization->getCountry(), 'persons' => $persons, 'activities' => $activities, 'connectors' => $connectors Loading @@ -191,14 +190,12 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy 'type' => $this->getType(), 'body' => [ 'size' => 10000, "query" => [ 'query_string' => [ 'multi_match' => [ 'fields' => [ 'code^3', 'shortname^4', 'fullname^8', 'code^7', 'shortname^9', 'fullname^5', 'description', 'email', 'city', Loading @@ -209,53 +206,11 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy 'persons', 'activities' ], "fuzziness"=> "auto", 'query' => $search, ] // "bool" => [ // "should" => [ // [ "match" => [ // "code" => [ // "query" => "$search", // "boost" => 1 // ] // ]], // [ "match" => [ // "shortname" => [ // "query" => "$search", // "boost" => 10 // ] // ]], // [ "match" => [ // "fullname" => [ // "query" => "$search", // "boost" => 5 // ] // ]], // ] // ] ] /* OFF 'query' => [ 'query_string' => [ "search_fields" => [ "shortname" => [ "weight" => 10 ], "code" => [ "weight" => 2 ], "fullname" => [ "weight" => 2 ], ], 'query' => $search, 'use_dis_max' => true ], ] /******/ ] ]; Loading Loading @@ -310,5 +265,77 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy } catch (\Exception $e) { throw $e; } try { $this->getClient()->indices()->create( [ 'index' => $this->getIndex(), 'body' => [ 'settings' => [ 'analysis' => [ 'analyzer' => [ 'noaccent' => [ "type" => "custom", "tokenizer" => "standard", "filter" => ['asciifolding', "lowercase"] ] ], ] ], 'mappings' => [ "organization" => [ 'properties' => [ 'code' => [ 'type' => 'keyword', ], 'shortname' => [ 'type' => 'text', // 'analyzer' => 'noaccent' ], 'fullname' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'description' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'email' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'city' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'siret' => [ 'type' => 'keyword', ], 'country' => [ 'type' => 'keyword', ], 'connectors' => [ 'type' => 'keyword', ], 'zipcode' => [ 'type' => 'keyword', ], 'persons' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'activities' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], ] ] ] ] ] ); } catch (\Exception $e) { throw new OscarException("Impossible de créer l'index de recherche : \n---\n" . $e->getMessage()); } } } No newline at end of file module/Oscar/src/Oscar/Strategy/Search/PersonElasticSearch.php +4 −15 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ class PersonElasticSearch implements PersonSearchStrategy 'body' => [ 'size' => 10000, 'query' => [ 'query_string' => [ 'multi_match' => [ 'query' => $searchQuery, 'fields' => [ 'fullname^4', Loading @@ -102,23 +102,12 @@ class PersonElasticSearch implements PersonSearchStrategy 'affectation^5', 'organizations^5', 'activities^5', 'connectors'] 'connectors' ], "fuzziness"=> "auto" ] ] ] // 'body' => [ // 'size' => $limit, // 'query' => [ // 'multi_match' => [ // 'query' => $searchQuery, // 'type' => 'phrase_prefix', // 'fields' => ['fullname^6','lastname^5', 'firstname^2', 'email', 'affectation^3', 'location^3', 'organizations', 'activities', 'connectors'], // /* 'max_expansions' => 20,*/ // /*'fuzziness' => 1*/ // ] // ] // ] ]; $response = $this->getClient()->search($params); Loading Loading
front/src/components/OrganizationAutoCompleter.vue +50 −39 Original line number Diff line number Diff line <template> <div> <small>{{ filteredOptions.length }}</small> <v-select @search="handlerSearchOrganisation" placeholder="Rechercher une structure" :options="filteredOptions" :options="options" label="label" v-model="value" :reduce="item => item.id" :dropdown-should-open="dropdownShoultOpen" @input="setSelected" > <template #list-header> Loading Loading @@ -38,6 +41,7 @@ </div> </template> </v-select> </div> </template> <script> Loading Loading @@ -132,7 +136,7 @@ export default { if (this.delay != null) { clearTimeout(this.delay); } this.delay = setTimeout(delayFunction, 1000); this.delay = setTimeout(delayFunction, 300); } }, Loading @@ -143,7 +147,10 @@ export default { * @param vm */ searchOrganization(loading, search, vm) { let closeOpt = this.displayClosed ? '&active=' : '&active=ON' console.log("PRELOADVALUE:", this.preloadedValue); this.$http.get('/organization?l=m&q=' + encodeURI(search)).then( ok => { if (this.preloadedValue == false) { Loading @@ -161,6 +168,10 @@ export default { } ) }, dropdownShouldOpen(VueSelect) { console.log("dropdownShouldOpen"); return VueSelect.close; }, } } </script> No newline at end of file
module/Oscar/src/Oscar/Command/OscarOrganizationsSearchCommand.php +7 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ namespace Oscar\Command; use Moment\Moment; use Oscar\Entity\Authentification; use Oscar\Entity\LogActivity; use Oscar\Entity\Organization; use Oscar\Entity\Person; use Oscar\Entity\Role; use Oscar\Service\ConnectorService; Loading Loading @@ -59,8 +60,13 @@ class OscarOrganizationsSearchCommand extends OscarCommandAbstract try { $search = $input->getArgument('search'); $organisations = $organisationService->search($search); /** @var Organization $organisation */ foreach ($organisations as $organisation) { $io->writeln(sprintf('- <bold>[%s]</bold> %s (%s)', $organisation->getId(), (string)$organisation, $organisation->getCode())); $io->writeln(sprintf('- <bold>[%s]</bold> [%s] %s (%s)', $organisation->getId(), $organisation->getShortName(), $organisation->getFullName(), $organisation->getCode())); } } catch (\Exception $e ){ $io->error($e->getMessage() . "\n" . $e->getTraceAsString()); Loading
module/Oscar/src/Oscar/Strategy/Search/ActivityElasticSearch.php +3 −2 Original line number Diff line number Diff line Loading @@ -198,12 +198,13 @@ class ActivityElasticSearch implements ActivitySearchStrategy 'numbers^9', 'oscar^9', 'label^7', 'description^7', 'description^2', 'project^5', 'disciplines^5', 'activitytype^2', 'partners^5', 'members^5'] 'members^5'], "fuzziness"=> "auto" ] ] ] Loading
module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php +80 −53 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use Oscar\Connector\ConnectorRepport; use Oscar\Entity\ActivityOrganization; use Oscar\Entity\Organization; use Oscar\Entity\OrganizationPerson; use Oscar\Exception\OscarException; class OrganizationElasticSearch implements OrganizationSearchStrategy { Loading Loading @@ -63,6 +64,8 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy ->setHosts($this->getHosts()) ->build(); } return $this->elasticSearchClient; } Loading Loading @@ -173,11 +176,7 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy 'country' => $organization->getCountry(), 'zipcode' => $organization->getZipCode(), 'description' => $organization->getDescription(), // 'address1' => $organization->getStreet1(), // 'address2' => $organization->getStreet2(), // 'address3' => $organization->getStreet3(), 'siret' => $organization->getSiret(), 'country' => $organization->getCountry(), 'persons' => $persons, 'activities' => $activities, 'connectors' => $connectors Loading @@ -191,14 +190,12 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy 'type' => $this->getType(), 'body' => [ 'size' => 10000, "query" => [ 'query_string' => [ 'multi_match' => [ 'fields' => [ 'code^3', 'shortname^4', 'fullname^8', 'code^7', 'shortname^9', 'fullname^5', 'description', 'email', 'city', Loading @@ -209,53 +206,11 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy 'persons', 'activities' ], "fuzziness"=> "auto", 'query' => $search, ] // "bool" => [ // "should" => [ // [ "match" => [ // "code" => [ // "query" => "$search", // "boost" => 1 // ] // ]], // [ "match" => [ // "shortname" => [ // "query" => "$search", // "boost" => 10 // ] // ]], // [ "match" => [ // "fullname" => [ // "query" => "$search", // "boost" => 5 // ] // ]], // ] // ] ] /* OFF 'query' => [ 'query_string' => [ "search_fields" => [ "shortname" => [ "weight" => 10 ], "code" => [ "weight" => 2 ], "fullname" => [ "weight" => 2 ], ], 'query' => $search, 'use_dis_max' => true ], ] /******/ ] ]; Loading Loading @@ -310,5 +265,77 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy } catch (\Exception $e) { throw $e; } try { $this->getClient()->indices()->create( [ 'index' => $this->getIndex(), 'body' => [ 'settings' => [ 'analysis' => [ 'analyzer' => [ 'noaccent' => [ "type" => "custom", "tokenizer" => "standard", "filter" => ['asciifolding', "lowercase"] ] ], ] ], 'mappings' => [ "organization" => [ 'properties' => [ 'code' => [ 'type' => 'keyword', ], 'shortname' => [ 'type' => 'text', // 'analyzer' => 'noaccent' ], 'fullname' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'description' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'email' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'city' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'siret' => [ 'type' => 'keyword', ], 'country' => [ 'type' => 'keyword', ], 'connectors' => [ 'type' => 'keyword', ], 'zipcode' => [ 'type' => 'keyword', ], 'persons' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], 'activities' => [ // 'analyzer' => 'noaccent', 'type' => 'text', ], ] ] ] ] ] ); } catch (\Exception $e) { throw new OscarException("Impossible de créer l'index de recherche : \n---\n" . $e->getMessage()); } } } No newline at end of file
module/Oscar/src/Oscar/Strategy/Search/PersonElasticSearch.php +4 −15 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ class PersonElasticSearch implements PersonSearchStrategy 'body' => [ 'size' => 10000, 'query' => [ 'query_string' => [ 'multi_match' => [ 'query' => $searchQuery, 'fields' => [ 'fullname^4', Loading @@ -102,23 +102,12 @@ class PersonElasticSearch implements PersonSearchStrategy 'affectation^5', 'organizations^5', 'activities^5', 'connectors'] 'connectors' ], "fuzziness"=> "auto" ] ] ] // 'body' => [ // 'size' => $limit, // 'query' => [ // 'multi_match' => [ // 'query' => $searchQuery, // 'type' => 'phrase_prefix', // 'fields' => ['fullname^6','lastname^5', 'firstname^2', 'email', 'affectation^3', 'location^3', 'organizations', 'activities', 'connectors'], // /* 'max_expansions' => 20,*/ // /*'fuzziness' => 1*/ // ] // ] // ] ]; $response = $this->getClient()->search($params); Loading