Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009

    Exclamation Unanswered: Full text search in postgres

    Hi All,
    this is the first time i m using full text search. I am trying to search for the text entered by user and i search for that text in three columns.
    if it is a normal search i can avoid invalid characters but which character do i need to make sure are not there in the search string for full text...

    if i enter "test" in the search box with double quotes returns an error if i enter a search called (test without the closing braces it returns an error.

    so my question is what are the characters to be avoid or be replace by in the a full text search string

  2. #2
    Join Date
    Jun 2004
    Arizona, USA
    The actual SQL used, along with the errors you received would probably be helpful.

    Text strings must be delimited with the apostrophe (') character. If you need to search for for a quoted test ("test") you would use '"test"'.

    If you need to search for the apostrophe within a text string, double it.

    SELECT column1
    FROM yourtable
    WHERE to_tsvector('english', body) @@ to_tsquery('english', 'O''Brian')
    ref PostgreSQL: Documentation: Manuals: PostgreSQL 8.3: Controlling Text Search
    Last edited by loquin; 03-05-09 at 16:08.
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts