Data Explorer Plugin

Have to use a different kind of query:

phraseto_tsquery('human workflow')

does the trick.

3 Likes

So here’s some very odd behavior. I now have 2 queries defined. One uses
phrase_tsquery() as mentioned above to do an exact phrase match. The other uses TO_TSQUERY(:query) to match any/all search terms.

-- [params]
-- string :query = 'connectors'

SELECT p.id as post_id, p.raw as raw FROM posts p
LEFT JOIN post_search_data psd ON psd.post_id = p.id
WHERE psd.search_data @@ phraseto_tsquery(:query)

And

-- [params]
-- string :query = 'connectors'

SELECT p.id as post_id, p.raw as raw FROM posts p
LEFT JOIN post_search_data psd ON psd.post_id = p.id
WHERE psd.search_data @@ TO_TSQUERY(:query)

If I run those queries from the queries page in the Admin console, the first returns zero results, and the second returns 71 results.

The first is saved as query 4, the second as query 3. When I call the forum.com/admin/plugin/queries/3/run or /4/run via an API call, I get the exact same results. 71 results. And it’s the results for the #3 query. How can that be possible??

1 Like