Okay, two points now that I've found another moment to think about this: * Sphinx does support multiple indexes. Names are separated by commas. * As a quick fix, you could add a custom attribute with the same name to your other models has '0', :as => :language_id, :type => :integer
This may be a pain if there's a ton of models, but for a handful, it should allow everything to work nicely. As for a neater solution, I've created an issue on GitHub. I really don't know if I'll have time this weekend to look at it though. http://github.com/freelancing-god/thinking-sphinx/issues/#issue/33 -- Pat On 09/09/2009, at 1:15 PM, Pat Allan wrote: > > Hi Graham > > Sorry for the pause in communication - work and life is pretty busy at > the moment. > > The first thing I need to do (or if you want to search around, please > do) is confirm whether Sphinx can limit searches to multiple indexes. > The API allows for a string specifying an index name, which defaults > to '*' for *all* indexes (Thinking Sphinx's behaviour). What I'm > looking for is whether there's syntax (comma-separated, perhaps) for > multiple index names, instead of just one. > > -- > Pat > > On 09/09/2009, at 10:54 AM, Graham Glass wrote: > >> >> Hi Pat, >> >> Any feedback on this issue? >> It's quite important that I solve the problem soon. >> >> Thanks! >> Graham >> >> On Sep 8, 1:42 am, Graham Glass <[email protected]> wrote: >>> Hi Pat, >>> >>> Thanks for your response! >>> The search doesn't work at all; here's an example: >>> >>> results = ThinkingSphinx::Search.search 'donkey', :conditions => >>> {:language_id => 1}, :classes => [WebResource, Book] >>> >>> output: >>> >>> matches = [[], {:attribute_names=>[], :error=>"index >>> book_core >>> ,district_core,group_core,klass_core,message_core,posting_core,sch >>> ool_core,web_resource_core: >>> query error: no field 'language_id' found in >>> schema", :status=>1, :fields=>[], :matches=>[], :attributes=> >>> {}, :words=>{}}] >>> >>> On WebResource and Book I have the following: >>> >>> define_index do >>> # fields >>> indexes name, :sortable => true >>> >>> # attribute >>> has metadata.language_id >>> end >>> >>> where metadata is an object associated with the Material. None of >>> the >>> other classes that I've indexed have a language_id attribute. The >>> rake >>> task for indexing works fine; it's only searching for a selection of >>> classes that fails. >>> >>> Cheers, >>> Graham >>> >>> On Sep 8, 1:32 am, Pat Allan <[email protected]> wrote: >>> >>> >>> >>>> Hi Graham >>> >>>> Firstly, does the search work, even with the warning? (I would >>>> expect >>>> it to) >>> >>>> If it doesn't, then I'm happy to try and fix things (and if it's >>>> via >>>> consulting, let's discuss offlist) - the only issue I'm not sure >>>> about >>>> is whether we can limit searches to multiple indexes. I can >>>> definitely >>>> investigate that, though. >>> >>>> -- >>>> Pat >>> >>>> On 08/09/2009, at 8:01 AM, Graham Glass wrote: >>> >>>>> Hi everyone, >>> >>>>> I've posted a few times in the past about the following problem, >>>>> but I >>>>> think the only way to address it is to add at least one new >>>>> feature to >>>>> Thinking Sphinx. If there is someone who can add it on a >>>>> consulting >>>>> basis, I'm happy to contribute the resulting code back to the open >>>>> source community! >>> >>>>> Here's the issue: >>> >>>>> I have many Ruby classes that are being indexed. It's an education >>>>> domain, so I have classes like "School" and "Class". I also have a >>>>> bunch of resource types that have a common abstract base class >>>>> "Material". The concrete subclasses are things like "Book" and >>>>> "Curriculum". Each subclass is stored in its own table which is >>>>> why >>>>> the base class is abstract. >>> >>>>> I need to be able to do a search over one or more classes that >>>>> extend >>>>> "Material". In other words, I'd like to be able to so this: >>> >>>>> ThinkingSphinx.search "phrase", :conditions => 'format = >>>>> "pdf"', :classes => [Book, Curriculum] >>> >>>>> The trouble is, Sphinx gives me an error saying it can't find the >>>>> 'format' attribute in the schema for "School" and "Class" (which >>>>> seems >>>>> odd since I'm not searching over them). >>> >>>>> So I need Sphinx to be improved so I can search over a list of >>>>> classes >>>>> without it blowing up because other classes that I'm not searching >>>>> over don't have the specified attributes. >>> >>>>> Can anyone help? If not, I'll try to figure how to hack Sphinx >>>>> myself, >>>>> but it's not an effective use of my time and I'd rather pay >>>>> someone >>>>> else to do a nice job of it so it can be reused by the community. >>> >>>>> Thanks! >>>>> Graham >>> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
