Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SS 2.4 rc1 PostgreSQL and searchEngine

Go to End



Community Member, 52 Posts

7 April 2010 at 4:37am

Edited: 07/04/2010 8:25pm

Hi all:

I need to put search engine working in my SS 2.4 with PostgreSQL.
In the file PostgreSQLDatabase.php, function searchEngine , the query

$result=DB::query("SELECT table_name, column_name, data_type FROM information_schema.columns WHERE data_type='tsvector' AND table_name in ('" . implode("', '", $classesToSearch) . "');");

needs to be changed to:
$result=DB::query("SELECT \"table_name\", \"column_name\", \"data_type\" FROM \"information_schema\".\"columns\" WHERE \"data_type\"='tsvector' AND \"table_name\" in ('" . implode("', '", $classesToSearch) . "');");

to work correctly.
Now, the SQL gives no error, but is empty, so the line

if (!$result->numRecords()) throw Exception('there are no full text columns to search');

is executed.

I have execute the query to see all date_type values and does not exist in any table with "tsvector" date_type.
I change the query to:

$result=DB::query("SELECT \"table_name\", \"column_name\", \"data_type\" FROM \"information_schema\".\"columns\" WHERE \"data_type\"='text' AND \"table_name\" in ('" . implode("', '", $classesToSearch) . "');");

but now I´m having new error function ts_rank(text, tsquery) does not exist".
What I´m doing bad? Is the searcEngine tested with PostgreSQL?