No but assuming you have done this:
1. ALTER TABLE blog_entry ADD COLUMN body_tsv tsvector;
2. CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON
blog_entry
FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(body_tsv,
'pg_catalog.english', body);
3.CREATE INDEX blog_entry_tsv ON blog_entry USING gin(body_tsv);
You can write this:
4. SELECT title FROM blog_entry WHERE body_tsv @@ plainto_tsquery
('hello world');
as
db("body_tsv @@ plainto_tsquery('hello world')").select
(db.blog_entry.title)
I have not tried it but it should work.
Massimo
On Sep 22, 4:34 am, max <[email protected]> wrote:
> I have created a full text index on a postgres database.
> Is there any web2py type search syntax for tsvector search without
> using the sql syntax?
>
> This is a example way how i create the fulltext index.
>
> 1. ALTER TABLE blog_entry ADD COLUMN body_tsv tsvector;
> 2. CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON
> blog_entry
> FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(body_tsv,
> 'pg_catalog.english', body);
> 3.CREATE INDEX blog_entry_tsv ON blog_entry USING gin(body_tsv);
> 4. SELECT title FROM blog_entry WHERE body_tsv @@ plainto_tsquery
> ('hello world');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---