How to replace the where cause (want to use full text search) ?g

Hi, all.

I want to use full text search in Postgresql using a grid application. But I cannot found a way to change the “where” cause. What I did:

  • SQL, “select * from document”

  • grid’s event onScriptInit, sc_select_where(add) = "where document_search @@ to_tsquery(‘english’, {document_search}) ";
    But I got run time error and the resulting SQL is:
    “select count(*) from “public”.document where document_search = 'invoice’where document_search @@ to_tsquery(‘english’, invoice )”

  • search’s event onScriptInit, sc_select_where(add) = "where document_search @@ to_tsquery(‘english’, {document_search}) ";
    No record found.

From the DB log, it looks like “@@” has lost, is that right ?

Where can I custom the “where” cause ?

Regards,

Almond Wong

never used Postgresql, what value can add over mysql?

I don’t use Postgres but I can at least comment on this part: you should drop the ‘WHERE’ here because there will already be a ‘WHERE’ in the statement. Don’t understand the syntax ‘@@’ but it should probably be something like

sc_select_where(add) = " AND document_search @@ to_tsquery(‘english’, {document_search}) ";

(note the space before the AND)

assumed the @ has something to do with postgres

Definitely!