{"action":"opened","issue":{"url":"https://api.github.com/repos/FriendsOfCake/search/issues/87","repository_url":"https://api.github.com/repos/FriendsOfCake/search","labels_url":"https://api.github.com/repos/FriendsOfCake/search/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfCake/search/issues/87/comments","events_url":"https://api.github.com/repos/FriendsOfCake/search/issues/87/events","html_url":"https://github.com/FriendsOfCake/search/issues/87","id":155830662,"number":87,"title":"Search on concatenated fields","user":{"login":"markvdlaan93","id":12486278,"avatar_url":"https://avatars.githubusercontent.com/u/12486278?v=3","gravatar_id":"","url":"https://api.github.com/users/markvdlaan93","html_url":"https://github.com/markvdlaan93","followers_url":"https://api.github.com/users/markvdlaan93/followers","following_url":"https://api.github.com/users/markvdlaan93/following{/other_user}","gists_url":"https://api.github.com/users/markvdlaan93/gists{/gist_id}","starred_url":"https://api.github.com/users/markvdlaan93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markvdlaan93/subscriptions","organizations_url":"https://api.github.com/users/markvdlaan93/orgs","repos_url":"https://api.github.com/users/markvdlaan93/repos","events_url":"https://api.github.com/users/markvdlaan93/events{/privacy}","received_events_url":"https://api.github.com/users/markvdlaan93/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-19T20:44:29Z","updated_at":"2016-05-19T20:44:29Z","closed_at":null,"body":"Currently, I'm trying to search on two fields that are concatenated (in my case first_name and last_name merged into name). However, this setting doesn't work since it ignores Search.Like entirely (normal search on single field does work).  I have the following code in my initialize method in my model:\r\n\r\n$this->searchManager()\r\n            ->add('id', 'Search.Value')\r\n            ->add('q', 'Search.Like', [\r\n                'before' => true,\r\n                'after' => true,\r\n                'field' => [$this->aliasField('username'), $this->aliasField('name')]\r\n            ])\r\n            ->add('q', 'Search.Callback', [\r\n                'callback' => function ($query, $args, $manager) {\r\n                   return $query->select(['name' => $query->func()->concat(\r\n                        ['first_name' => 'identifier', ' ' , 'last_name' => 'identifier']\r\n                    )]);\r\n                }\r\n            ]);\r\n\r\nThe controller function that calls the search plugin uses the crud plugin v4 and is nothing special:\r\n\t\r\npublic function index(){\r\n\t\t$this->Crud->on('beforePaginate', function(\\Cake\\Event\\Event $event) {\r\n\t\t\t$event->subject()->query->select(['id', 'username']);\r\n\t\t});\r\n\t\treturn $this->Crud->execute();\r\n}\r\n\r\nHow can I search on concatenated fields?\r\n"}}