Commit bebb0ea2 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

MAJ recherche sur les activités

parent 5a73db9f
Loading
Loading
Loading
Loading
Loading
+16 −49
Original line number Diff line number Diff line
@@ -200,18 +200,17 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear
            ]
        ];

        // Champs Oscar
        $query["bool"]["should"][] = [ "match" => [ "oscar" => [ "query" => $search, "boost" => 20 ]]];
        $query["bool"]["should"][] = [ "prefix" => [ "oscar" => [ "value" => $search, "boost" => 5]]];

////        // Champs Oscar
//        $query["bool"]["should"][] = [ "match" => [ "oscar" => [ "query" => $search, "boost" => 20 ]]];
//        $query["bool"]["should"][] = [ "prefix" => [ "oscar" => [ "value" => $search, "boost" => 5]]];
////
////        // Champ EOTP
//        $query["bool"]["should"][] = [ "match" => [ "eotp" => [ "query" => $search, "boost" => 20 ]]];
//        $query["bool"]["should"][] = [ "prefix" => [ "eotp" => [ "value" => $search, "boost" => 5]]];
        // Champ EOTP
        $query["bool"]["should"][] = [ "match" => [ "eotp" => [ "query" => $search, "boost" => 20 ]]];
        $query["bool"]["should"][] = [ "prefix" => [ "eotp" => [ "value" => $search, "boost" => 5]]];

//        // Champ ACRONYM
//        $query["bool"]["should"][] = [ "match" => [ "acronym" => [ "query" => $search, "fuzziness" => "auto", "boost" => 20 ]]];
//        $query["bool"]["should"][] = [ "prefix" => [ "acronym" => [ "value" => strtolower($search), "boost" => 5]]];
        // Champ ACRONYM
        $query["bool"]["should"][] = [ "match" => [ "acronym" => [ "query" => $search, "fuzziness" => "auto", "boost" => 20 ]]];
        $query["bool"]["should"][] = [ "prefix" => [ "acronym" => [ "value" => strtolower($search), "boost" => 5]]];

        // Champ LABEL/PROJECT LABEL
        $query["bool"]["should"][] = [ "match" => [ "label" => [ "query" => $search, "fuzziness" => "auto", "boost" => 4 ]]];
@@ -221,48 +220,16 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear
        $query["bool"]["should"][] = [ "match" => [ "numbers" => [ "query" => $search, "fuzziness" => "auto", "boost" => 5 ]]];


        // Champ MOTSCLES
        $query["bool"]["should"][] = [ "match" => [ "motscles" => [ "query" => $search, "fuzziness" => "auto", "boost" => 5 ]]];
        $query["bool"]["should"][] = [ "match" => [ "disciplines" => [ "query" => $search, "fuzziness" => "auto", "boost" => 5 ]]];

        $query["bool"]["should"][] = [ "match" => [ "activitytype" => [ "query" => $search, "fuzziness" => "auto", "boost" => 3 ]]];
        $query["bool"]["should"][] = [ "match" => [ "description" => [ "query" => $search, "fuzziness" => "auto", "boost" => 2 ]]];
        $query["bool"]["should"][] = [ "match" => [ "partners" => [ "query" => $search, "fuzziness" => "auto"]]];
        $query["bool"]["should"][] = [ "match" => [ "members" => [ "query" => $search, "fuzziness" => "auto"]]];


        /**
         * "query_string" => [
         * "query"  => $andQuery,
         * "fields" => [
         * 'oscar^20',
         * 'eotp^20',
         * 'acronym^15',
         * 'numbers^10',
         * 'motscles^7',
         * 'disciplines^7',
         * 'label^5',
         * 'project^5',
         * 'activitytype^3',
         * 'description^2',
         * 'partners',
         * 'members'
         * ]
         * ]
         * ];
         * var_dump($query); die();
         * }
         * else {
         * $query["bool"]["should"] = [
         * ["match" => ["oscar" => ["query" => $andQuery, "boost" => 20]]],
         * ["match" => ["eotp" => ["query" => $andQuery, "boost" => 20]]],
         * ["match" => ["acronym" => ["query" => $andQuery, "boost" => 15]]],
         * ["match" => ["numbers" => ["query" => $andQuery, "boost" => 10]]],
         * ["match" => ["motscles" => ["query" => $andQuery, "boost" => 7]]],
         * ["match" => ["disciplines" => ["query" => $andQuery, "boost" => 7]]],
         * ["match" => ["label" => ["query" => $andQuery, "boost" => 5]]],
         * ["match" => ["activitytype" => ["query" => $andQuery, "boost" => 3]]],
         * ["match" => ["project" => ["query" => $andQuery, "boost" => 5]]],
         * ["match" => ["description" => ["query" => $andQuery, "boost" => 1]]],
         * ["match" => ["partners" => ["query" => $andQuery, "boost" => 1]]],
         * ["match" => ["members" => ["query" => $andQuery, "boost" => 1]]],
         * ];
         * }
         * ****/

        return $query;
    }