Adam K
Adam K

Reputation:

Thinking Sphinx indexing non-expired records

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.

Upvotes: 1

Views: 389

Answers (2)

Nikhil Gupte
Nikhil Gupte

Reputation: 3316

PostgreSQL also accepts the function 'now()'

Upvotes: 0

pat
pat

Reputation: 16226

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

Upvotes: 3

Related Questions