Using PostgreSQL 8.3 and fulltext indexing, before QS-RF I was able to
execute queries like:
-----
q = 'hello world'
queryset = Entry.objects.extra(
select={
'snippet': "ts_headline(body, query)",
'rank': "ts_rank_cd(body_tsv, query, 32)",
},
tables=["plainto_tsquery(%s) as query"],
where=["body_tsv @@ query"],
params=[q]
)
-----
After updating to include QS-RF, it seems that the 'tables' parameter
to the extra() method is copied without parameter substitution
straight into the SQL 'FROM' clause, and with the entire thing
quoted. So that before I was getting something like
SELECT FROM plainto_tsquery('hello world') as query,
blog_entry, ....
but now, it's ending up as something like:
SELECT FROM "plainto_tsquery(%s) as query", blog_entry, ....
any thoughts on the best way to do this now with QS-RF?
In the meantime as a workaround, I'm just repeating the call to the
PostgreSQL plainto_tsquery() function 3 times, as in:
-----
q = 'hello world'
queryset = Entry.objects.extra(
select={
'snippet': "ts_headline(body, plainto_tsquery(%s))",
'rank': "ts_rank_cd(body_tsv, plainto_tsquery(%s), 32)",
},
where=["body_tsv @@ query"],
params=[q],
select_params=[q, q]
)
-----
which I have to think isn't quite as efficient (if it is, that'd be
good to know).
Barry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---