Question

What would be the best approach to have Thinking Sphinx only index records where Today's date is less than or equal to the record's "expires_at" field?

Thanks in advance.

No correct solution

OTHER TIPS

The easiest approach is adding the following statement to your define_index block:

where "expired_at >= NOW()"

That's the MySQL version, anyway. PostgreSQL will be pretty similar:

where "expired_at >= current_timestamp"

Although, I'm no PostgreSQL expert, but hopefully that's close enough to what's needed.

Cheers

PostgreSQL also accepts the function 'now()'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow