Wow ! I learned something on GROUP_CONCAT. Amazing.
I ran the generated SQL by hand and it's ... perfect ! Bravo.
And while I'm on the phone, is it possible to use a field's value as
field name ?
Example: database contains the following dynamic attributes:
key:"address" value:"by the lake"
key:"city" value:"Lausanne"
Is it possible to build an index so that you can search
Node.search :conditions => { "address" => "lake", "city" => "Lausanne" }
Or is this the only option:
Node.search(:conditions => { :key => "address", :value => "lake" }) &
Node.search(:conditions => { :key => "city", :value => "Lausanne" })
Gaspard
---
FYI, this is my (current) define_index:
define_index do
indexes name
indexes versions.title, :as => 'title'
indexes versions.text, :as => 'text'
indexes versions.dynamic_attributes.value, :as => 'attribute'
has site_id
where "versions.status >= #{Zena::Status[:pub]}"
set_property :field_weights => { :title => 5, :text => 2, :attribute => 1 }
set_property :group_concat_max_len => 30000 # FIXME: articles can
easily have a length of 17000 chars...
set_property :delta => true
end
On Tue, Nov 3, 2009 at 2:14 AM, Pat Allan <[email protected]> wrote:
>
> Hi Gaspard
>
> You really should only have one result per article - if you're using
> the versions association, then all data from that should be grouped
> together, and either there'll be GROUP BY articles.id in your
> generated SQL statement, or (if you're using MySQL and it's configured
> a certain way), it'll automatically group by the article id.
>
> If I'm wrong about this... what's your define_index block looking
> like, and what's the generated sql_query in the configuration file?
>
> Cheers
>
> --
> Pat
>
> On 03/11/2009, at 7:22 AM, Gaspard Bucher wrote:
>
>>
>> Hi list !
>>
>> I am starting to configure thinking-sphinx to work with zena (open
>> source rails CMS: http://zenadmin.org) and found it great !
>>
>> I nearly asked tons of questions, but found all the documentation I
>> needed online except for one point: since a has_many generates LEFT
>> JOINS in the SQL query, this produces many more 'article' records (one
>> for each joined 'version'). Does this mean that the text in the
>> article will have a much higher weight ?
>>
>> Generally, how is relevance computed ?
>>
>> Anyway, thanks a lot for the great work !
>>
>> Gaspard
>>
>> >
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---