thanks for your answer. even though it's not what i was hoping for :-)

i'll try and investigate further.

Pascal



On Aug 23, 3:37 pm, Pat Allan <[email protected]> wrote:
> Hmm, looks like this is the limitation with raw SQL being used for  
> facets - it's vastly harder to programmatically figure out what the  
> facet values are.
>
> Unfortunately, at this point, it looks like TS most definitely does  
> not support raw SQL for facets. Feel free to investigate and patch -  
> or at least add a ticket to the GitHub issues list - but I'm afraid  
> I'm not going to be fixing this up soon, it's not high priority  
> (within TS feature requests, and in life in general - not sure how  
> much time I'll have to spend on TS over the next couple of months).
>
> Sorry, I realise this isn't particularly helpful.
>
> --
> Pat
>
> On 23/08/2009, at 12:56 PM, pascal wrote:
>
>
>
>
>
> > Hey Pat
>
> > Thanks a lot. Switching from String to Symbol brought me one step
> > further. The attribute is not doubled in the config file anymore and
> > the rake ts:in does not output a warning anymore.
>
> > Unfortunately there is another problem now:
>
> >>> Wine.facets
> > Querying Sphinx:
> >  Wine Load (0.3ms)   SELECT * FROM `wines` WHERE (`wines`.`id` IN
> > (51711515,887636893))
> > Querying Sphinx:
> >  Wine Load (0.3ms)   SELECT * FROM `wines` WHERE (`wines`.`id` IN
> > (51711515,51711515,51711515))
> > Querying Sphinx:
> >  Wine Load (0.3ms)   SELECT * FROM `wines` WHERE (`wines`.`id` IN
> > (51711515))
> > NoMethodError: undefined method `(select group_concat(gf.id) from
> > geographic_features gf where gf.lft <= geographic_features.lft and
> > gf.rgt >= geographic_features.rgt)' for #<Wine:0x2583688>
> >    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/attribute_methods.rb:260:in `method_missing'
> >    from /opt/local/lib/ruby/gems/1.8/gems/freelancing-god-thinking-
> > sphinx-1.2.7/lib/thinking_sphinx/facet.rb:100:in `send'
> >    from /opt/local/lib/ruby/gems/1.8/gems/freelancing-god-thinking-
> > sphinx-1.2.7/lib/thinking_sphinx/facet.rb:100:in `translate'
> >    from /opt/local/lib/ruby/gems/1.8/gems/freelancing-god-thinking-
> > sphinx-1.2.7/lib/thinking_sphinx/facet.rb:75:in `value'
> >    from /opt/local/lib/ruby/gems/1.8/gems/freelancing-god-thinking-
> > sphinx-1.2.7/lib/thinking_sphinx/facet_search.rb:112:in
> > `add_from_results'
>
> > Looks like the custom SQL statement is used as a method name. So i
> > still must be doing something wrong :-(
>
> > If you are interested in code which validates the arguments of has()/
> > indexes()  (String or Symbol vor :as, are all keys known) in the
> > define_index block, then let me know.
>
> > Pascal
>
> > On Aug 23, 1:09 pm, Pat Allan <[email protected]> wrote:
> >> Actually, just figured the cause: you need to set the attribute's  
> >> name
> >> as a symbol, not a string:
> >>    :as => :helloworld
>
> >> This should avoid the name duplication (haven't looked into the code
> >> in depth to figure out why, just tried to add failing specs)
>
> >> --
> >> Pat
>
> >> On 23/08/2009, at 11:54 AM, Pat Allan wrote:
>
> >>> Hi Pascal
>
> >>> Normally, TS should create two attributes, one named as you  
> >>> requested,
> >>> the other with the _facet suffix - *IF* dealing with arrays of items
> >>> that aren't all integers (or timestamps, which can be considered
> >>> integers). Because you're using a manual SQL string, TS has no idea
> >>> what the underlying type is for items in the array, and so assumes
> >>> that they're strings, hence the duplication as a CRC'd version of  
> >>> the
> >>> data.
>
> >>> That said, it should not be naming both versions of the attribute  
> >>> the
> >>> same thing - so that's a bug. I'll try to investigate it today.
>
> >>> --
> >>> Pat
>
> >>> On 23/08/2009, at 10:08 AM, pascal wrote:
>
> >>>> Hi
>
> >>>> I'm still trying to add a type multi attribute as a facet with a
> >>>> subselect query.
>
> >>>> When i add an attribute with a custom subselect with :type  
> >>>> => :multi
> >>>> and :facet => true then the attribute appears twice in the config  
> >>>> and
> >>>> "_facet" is appended to attribute name.
>
> >>>> So after:
> >>>> has '(select (group_concat ...) from ... where ...)', :as =>
> >>>> 'helloworld', :type => :multi, :facet => true
>
> >>>> I have twice the attr config:
>
> >>>> sql_attr_multi = uint helloworld_facet from field
> >>>> sql_attr_multi = uint helloworld_facet from field
>
> >>>> and the helloworld_facet appears twice in the sql_query, once with
> >>>> IFNULL and once with CRC32
>
> >>>> Running ts:in works nut yields following warning:
> >>>> WARNING: attribute 'helloworld_facet' not found - IGNORING
>
> >>>> Why is "_facet" appended to the name?
> >>>> Why is attribute config doubled?
>
> >>>> Thanks for your help.
>
> >>>> Pascal
--~--~---------~--~----~------------~-------~--~----~
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