Just a quick thought; has 'REPLACE(geographic_feature.dotted_ids, '.', ',')', :as=>'path', :type=>:multi, :facet=>true
or something along that line should make the attribute :path usable for a facet query, since Sphinx sees multiple integers separated by comma. Regards, Christian On 19 Aug., 14:26, pascal <[email protected]> wrote: > Christian thanks for your explanations. > > I am playing around with the "acts as tree with dotted ids" from > xavier (http://github.com/xavier/acts-as-tree-with-dotted-ids/tree/ > master) which basically stores the "path" from a tree node in dotted > form, i.e. "3.12.34.65" indicates that the parent of node with ID 65 > is the node with ID 34 and so on. > > I indexed this dotted id as an attribute: > > has geographic_feature.dotted_ids, :as => 'path', :type => :multi > > and this works for filtering (though i'm not sure it should work; > since i thought sphinx only supports integers for attributes?). This > is nice since i do not need an aditional query or queries (as would be > required with acts as tree or nested set). > > But unfortuanetly it does not work for facets. The facet hash for this > attribute is always empty. > > The sentence > "....in the second one the field will be parsed for integer values..." > fromhttp://www.sphinxsearch.com/docs/current.html#mvamade me think > that sphinx is able to extract integers from a column. > > Since i don't see how i can find the parents of a node in pure SQL > (MySQL does not support splitting of strings) i might be moving back > to nested set (where this should be a simple query with left/right in > the condition). > > As said, i'm only playing around to see how the dotted ids version > plays with sphinx... of course i'd still be happy if someone could > give me a hint how i can create a facetted MVA for a dotted id string. > > BTW: I really appreciate that the people on this list are helpful and > have a positive attitude. Thank you very much! > > On Aug 18, 3:04 pm, Christian Aust <[email protected]> > wrote: > > > > > Hi Pascal, > > > an attribute is multi-valued if Sphinx sees more than one value for > > it. (Well, that's not too surprising.) Since Thinking Sphinx generates > > a configuration for the Sphinx indexer that tells it how to get data > > from the SQL database, MVA are limited to everything you can do in > > SQL. In particular, you can't have a method of your model that returns > > a Ruby array of some sort and directly convert this into a MVA, > > because the indexer doesn't speak to your model but only to the > > database. > > > OK, so MVA are related to ActiveRecord associations. Like, class > > Book :has_many :chapters or else. In the index definitions of that > > class "Book" you could write: > > > indexes chapters.title, :as=>'chapter_title', :facet=>true > > > Depending on whether your activate facets or not (using :facet=>true) > > Sphinx will either see all values of chapter.title concatenated by > > spaces, or (if it's a facet) as a list of CRC32 checksums of all > > chapter titles, separated by commas. Only the latter is a MVA from > > Sphinx' perspective, the first is just one long string. > > > There's currently an open issue with facets of MVA that leads to > > unexpected results, but it is about to be resolved. Regards, > > > Christian > > > On 18 Aug., 13:51, pascal <[email protected]> wrote: > > > > Hi > > > > Some questions on MVA, hope there is someone around who can help me... > > > > How does Sphinx/TS parse MVA attributes? i could not find a > > > description of what is acceptable. > > > I found something that said it has to be CSV (comma separated values) > > > while it looks like space and dot are also ok? > > > > I've got some troubles getting MVA and facets working. Is it > > > supported? > > > rake ts:in generates > > > WARNING: attribute 'path_ids_facet' not found - IGNORING > > > and the path_id attribute is not indexed. > > > > the attributes appear in the ThinkingSphinx.facets hash but 'path_ids' > > > is always empty. > > > > Thanks for your help and time. > > > > 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 -~----------~----~----~----~------~----~------~--~---
