Hi Marcel

The following query is probably a bit better from a performance perspective:

  Article.search query,
    :id_range => article.id..article.id,
    :match_mode => :extended

If you only want to check that it exists, and not actually have the 
ActiveRecord object instantiated, you could call search_for_ids instead of 
search (or just pass :ids_only => true as an option into a normal search call).

Hope this helps.

-- 
Pat

On 22/06/2010, at 5:29 PM, Marcel Overdijk wrote:

> We are using Sphinx queries to autotag article content.
> 
> We have a list of Sphinx queries stored in our database together with
> tag to be added in case of a match.
> The list of Sphinx queries is now > 2000 rules.
> 
> For each new article we run all > 2000 Sphinx queries but this is
> getting very slow...
> This is what we are doing now:
> 
> query = <some user defined Sphinx query>
> results = Article.search(query, :with => { :article_id =>
> article.id }, :match_mode => :extended)
> 
> I'm wondering if there is alternative way to solve this?
> 
> 
> -- 
> 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