0

I'm trying to figure out how exactly does @@ operator work in postgres.

I have the two queries:

SELECT description FROM product WHERE description @@ '%apple%'
SELECT description FROM product WHERE description @@ 'apple'

The two queries return the same number of rows. Apparently postgres removes all non alfanumeric characters from the query. Is this actually the case?

I can also do @@ '@apple..,,.' and I still get the same number of results.

Catalin
  • 112
  • 1
  • 13

1 Answers1

1

@@ operator is part of TSearch2 Full Text Search Engine. It does remove such characters, by default. The topic of TSearch2 is way too big to include it all here, so I'll just point you to documentation.

  • Thank you for your answer. I already red the link before posting the question, but it doesn't say anything about how the query is preprocessed. – Catalin Feb 13 '13 at 09:00
  • 1
    Of course it does. Right side of @@ is tsquery. And tsquery is passed through the same parsers and dictionaries as tsvector. –  Feb 13 '13 at 10:47