Hi Brad

It's worth keeping in mind that you can query without instantiating 
ActiveRecord objects:

  Model.search_for_ids

The resulting collection also has a results method, which returns the raw 
Sphinx results - and this includes attribute values. So, if updated_at is an 
attribute, that removes the need to instantiate each search result as an 
ActiveRecord object.

  Model.search_for_ids.results[:matches]

I've not done anything about saved searches, but the idea of the MD5 hash 
sounds reasonable to me. However, I don't have any suggestions for dealing with 
facets, though.

Cheers

-- 
Pat

On 22/06/2010, at 5:26 AM, Brad Langhorst wrote:

> I'm working on a feature that will allow users to receive an email if
> one of their saved searches has changed since last time it ran.
> 
> I have a working system for saving and reproducing searches. I would
> appreciate some critical commentary if anyone is willing:
> 
> - when a search is run i calculate an md5 sum based on a concatenation
> of:
> * the number of items found
> * the type of each of the first 20 results
> * the id of each result
> * the updated_at value of each of the first 20 results
> 
> 
> I'm a bit concerned about having to look up each id and updated_at
> value, so I'll just do it for the first 20 values (which should be
> fine for this application).
> 
> Any suggestions for improvements?
> 
> Is there some elegant way of dealing with searches that returned
> faceted results as well as those that don't?
> 
> It would be nice to be able to email users about exactly what has
> changed, but that would require a transaction log of some type that
> looks like a lot of effort from my current vantage point.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" 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/thinking-sphinx?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" 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/thinking-sphinx?hl=en.

Reply via email to