Postgres FTI with SQLObject issue resolved
Friday, October 14th, 2005Ah joy. Figured out that SQLObject can be extended fairly easily to handle the ranking problem I referred to previously.
The goal is to end up with a query like this:
SELECT Foo.id, Foo.name, Foo.title, rank(Foo.fti, ftq('browser')) AS rank
FROM Foo WHERE Foo.fti @@ ftq('browser')
ORDER BY rank
So, hacking SQLObject to add a selectAlso= option to SQLObject.select gives us the ability to write code like this:
results = Foo.select("fti @@ ftq('browser')",
selectAlso="rank(fti, ftq('browser')) AS rank",
orderBy='-rank')
Voila. I’ll pass the SQLObject patch on to Stub for a review and submission upstream.