Could try it with a CASE instead:

   indexes "CASE name WHEN 'Loch Ness' THEN 'lake' ELSE '' END", :as  
=> :landmark

Although I'm sure there's an equivalent IF condition for PostgreSQL,  
but CASE statement is what I've come across first :)

-- 
Pat

On 27/04/2009, at 9:50 PM, esp wrote:

>
> Thanks James - comments inline
>
> On Apr 26, 9:24 pm, James Healy <[email protected]> wrote:
>> Hi Mike,
>>
>> esp wrote:
>>> 1) Is there any way to add static data into a  model.   For  
>>> example if
>>> a
>>> table with a row that has a name field that is "Loch Ness" is  
>>> there a
>>> way
>>> that I can add static text to this so it will return results for the
>>> keyword "lake".
>>
>> You can pass raw SQL fragments to TS in your define_index block.
>> Assuming you're using mysql:
>>
>>   indexes "IF(`name` = 'Loch Ness', 'lake','')", :as => :landmark
>>
> Not sure I follow the synax - I'm using PostgreSQL.
>
>>> 2) I attempted to use the delta mechanism but after added the delta
>>> column
>>> and the set propertly :delta => true into my define_index section of
>>> my
>>> model, indexing for the first time never completed.   I Hvae one  
>>> table
>>> with
>>> close to 7 million rows that takes maybe a couple of minutes to  
>>> index
>>> but
>>> after adding the delta and trying to create a fresh index, i let it
>>> run for
>>> 3 hours and it never even got to the point in the console output  
>>> that
>>> said
>>> it was processing.  It just showed the initial "creating index...".
>>
>> Is there an index on your delta column?
>>
> Doh!   Forgot to add an index.    That's gotta be it.  Thanks!
>> -- James Healy <jimmy-at-deefa-dot-com>  Mon, 27 Apr 2009 11:20:24  
>> +1000
>>
>>  signature.asc
>> < 1KViewDownload
> >


--~--~---------~--~----~------------~-------~--~----~
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