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
> 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?
-- James Healy <jimmy-at-deefa-dot-com> Mon, 27 Apr 2009 11:20:24 +1000
An indexes call can just be a string that contains a raw SQL statement.
Pretend you're adding a manual field to an SQL SELECT.
The comments in lib/thinking_sphinx/index/builder.rb have (some) further
information on this feature.
The IF() function is for MySQL, but I'm sure PostgreSQL will have
something equivalent.
-- James Healy <jimmy-at-deefa-dot-com> Mon, 27 Apr 2009 21:55:08 +1000