There's no direct option for > or < - the easiest way to take that approach is 
to use ranges, with the non-specific values really big or really small. So, 
time greater than now could be :time => Time.zone.now..1.year.from_now (or 
whatever's appropriate for your dataset).

On 5 Feb 2014, at 2:52 am, Thibault Clavel <[email protected]> wrote:

> Well, indexing time went from 20+ hours to less than a second, that's pretty 
> amazing !
> 
> While I am at it, is there a way to use the with: parameters with < and > 
> operators ? I haven't seen this in the documentation...
> 
> 
> 
> Le mardi 4 février 2014 11:56:14 UTC+1, Pat Allan a écrit :
> :source => :query shifts the attribute into its own SQL statement, which is 
> simpler and thus faster (I'm always surprised at how much faster it can be), 
> rather than adding extra joins and complexity to the main query covers the 
> rest of the index data.
> 
> Great to know it's helped!
> 
> -- 
> Pat
> 
> On 4 Feb 2014, at 9:22 pm, Thibault Clavel <[email protected]> wrote:
> 
>> Hi Pat,
>> 
>>  Adding :source => :query worked like a charm, I tested with other 
>> attributes thaht made indexing last forever and indexing is now lightning 
>> fast !
>> 
>>  What did that parameter change ?
>> 
>>  Thanks a lot anyways for your quick and effective answer, I was stuck on 
>> this since last week. :)
>> 
>> 
>> Le mardi 4 février 2014 11:01:01 UTC+1, Pat Allan a écrit :
>> Hi Thibault
>> 
>> Can you add the following option to each of the attributes you've defined: 
>> :source => :query - and see if that helps?
>> 
>> Also: in TS v3, delta options are specified alongside :with => 
>> :active_record:
>> 
>>   ThinkingSphinx::Index.define :card, :with => :active_record, :delta => 
>> true do
>>     # ...
>>   end
>> 
>> -- 
>> Pat
>> 
>> On 4 Feb 2014, at 8:11 pm, Thibault Clavel <[email protected]> wrote:
>> 
>>> Hi everyone,
>>> 
>>> I've set up TS 3.1.0 on a rails 4 app, which is what I would call a 
>>> "playing card manager".
>>> 
>>> Here is my Card index :
>>> 
>>> ThinkingSphinx::Index.define :card, :with => :active_record do
>>>   # fields
>>>   indexes name, :sortable => true
>>>   indexes name_en, :sortable => true
>>> 
>>>   has colors(:id), :as => :color_ids
>>>   has card_formats(:id), :as => :card_format_ids
>>>   has rarities(:id), :as => :rarity_ids
>>> 
>>> 
>>>   set_property :delta => true
>>> end
>>> 
>>> 
>>> Colors, Card Formats and Raritiers are all has_many through relationships 
>>> with the Card model. When I run rake ts:rebuild or ts;index, it takes less 
>>> than a minute to proceed.
>>> 
>>> If I add this line :
>>> 
>>>   has card_types(:id), :as => :card_type_ids
>>> 
>>> ... which is another has_many :through, indexing starts ("indexing 
>>> card_core") but seems to get stuck at this point. Last stime I let it run 
>>> for almost 20h with no progress. :(
>>> 
>>> If I run SHOW INDEX on the join table card_card_types, I get this :
>>> 
>>> mysql> SHOW INDEX FROM card_card_types;
>>> +-----------------+------------+---------------------------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
>>> | Table           | Non_unique | Key_name                              | 
>>> Seq_in_index | Column_name  | Collation | Cardinality | Sub_part | Packed | 
>>> Null | Index_type | Comment | Index_comment |
>>> +-----------------+------------+---------------------------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
>>> | card_card_types |          0 | PRIMARY                               |    
>>>         1 | id           | A         |       25550 |     NULL | NULL   |    
>>>   | BTREE      |         |               |
>>> | card_card_types |          1 | index_card_card_types_on_card_id      |    
>>>         1 | card_id      | A         |       25550 |     NULL | NULL   | 
>>> YES  | BTREE      |         |               |
>>> | card_card_types |          1 | index_card_card_types_on_card_type_id |    
>>>         1 | card_type_id | A         |          34 |     NULL | NULL   | 
>>> YES  | BTREE      |         |               |
>>> +-----------------+------------+---------------------------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
>>> 
>>> which seems OK to me, since card_id and card_type_id are indexes.
>>> 
>>> Any thoughts about this ?
>>> 
>>> Thanks a lot !
>>> 
>>> 
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Thinking Sphinx" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Thinking Sphinx" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to