i edit function search_objects_hook in search_hooks.php

i edit

$fields = array('title', 'description');


$fields = array('title');

because i dont want search the description

but it return Fatal Error


i discovered the reason is in function search_get_where_sql in start.php


$where = "(MATCH ($fields_str) AGAINST ('$query' $options))";

changed to

$where = "(MATCH (title,description) AGAINST ('$query' $options))";

it works fine


but if it changed to

$where = "(MATCH (title) AGAINST ('$query' $options))";

it return Fatal Error


why ?


  • The change you made in start.php in search_get_where_sql is nonsense. If you get a fatal error due to the change in search_hooks.php the change in start.php doesn't fix the problem for sure (it might only seem to do so as you don't get a fatal error anymore but only because the search parameters are modified in a way that you wouldn't get any results anyway or at least not the correct results).

    Are you sure that it doesn't work with

    $fields = array('title');

    in seach_hooks.php? I just tried it myself and it works fine. If you still get an error with only this change you might want to look into the server log to find out what the problem is (maybe you left the comma after 'title' in the code?).

  • I have to correct myself. There's a fatal error indeed with only changing the $fields line in search_hooks.php.

    Try it with also altering the following line:

        $fields = array('title');
        $where = search_get_where_sql('oe', $fields, $params, false);