Hi Pat, Thanks for all your help, I'll make a donation today!
Also, I just logged a question to the google group; it looks like Sphinx does a blank query every time I save a sphinx-enabled class, which seems rather odd. Any feedback on this would be much appreciated! Cheers, Graham On Sun, Sep 13, 2009 at 2:28 AM, Pat Allan <[email protected]> wrote: > > Hi Graham > > There's two reasons for that. Firstly, for default ascending order, > you'll need to use a symbol, not a string. However, in this case, > that's not perfect either, because you're searching on more than one > model, and so Thinking Sphinx doesn't have a reference point for > sortable fields. > > So, try the following instead: > ThinkingSphinx.search 'voyager', :classes => [Book, > WebResource], :order => :name_sort > > Of course, if name is an attribute, not a field, then :name will work > fine. > > -- > Pat > > On 13/09/2009, at 5:17 AM, Graham Glass wrote: > > > Hi Pat, > > > > I think I might have found a bug related to using the :order option. > > > > If I do this: > > > > results =ThinkingSphinx.search 'voyager', :classes => [Book, > > WebResource] > > > > then I get back a few results, but if I do this: > > > > results =ThinkingSphinx.search 'voyager', :classes => [Book, > > WebResource], :order => 'name' > > > > then I get back no results at all. 'name' is one of the indexes on > > both classes. > > > > Any idea what's going on? > > > > Cheers, > > Graham > > > > On Sat, Sep 12, 2009 at 3:27 PM, Graham Glass > > <[email protected]> wrote: > > Hi Pat, > > > > Thanks, you're awesome!! I just tried it out and it seems to work > > fine. I'm going to try it out on my entire system this weekend and > > make sure it works across the board. I'll let you know how it goes!! > > > > Cheers, > > Graham > > > > > > On Sat, Sep 12, 2009 at 3:37 AM, Pat Allan <p...@freelancing- > > gods.com> wrote: > > > > Well, the incentive plus the weekend helped - try the latest version > > (1.2.10), see how that goes :) > > > > -- > > Pat > > > > On 11/09/2009, at 9:54 PM, Graham Glass wrote: > > > > > Thanks Pat, that works great for me! > > > > > > Cheers, > > > Graham > > > > > > On Fri, Sep 11, 2009 at 9:50 AM, Pat Allan <p...@freelancing- > > > gods.com> wrote: > > > > > > Here's my suggestion: I will do my best to get this done at some > > point > > > over the weekend, and once it's all good, then you can (if you want > > > to) make a donation via the project pledgie: > > > http://pledgie.com/campaigns/1752 > > > > > > The longer I take (ie, if it ends up being late next week), the > > lower > > > your donation (for whatever base value you like) should be. > > > > > > -- > > > Pat > > > > > > On 11/09/2009, at 11:00 AM, Graham Glass wrote: > > > > > > > > > > > Hi Pat, > > > > > > > > Thanks for the update! > > > > > > > > My actual models have about 10 atttributes, so it would be nasty > > to > > > > add all 10 of these to my other 5 models. > > > > Once again, I'm more than happy to pay some kind of consulting > > rate > > > > for the work, if this helps your incentive :-) > > > > > > > > Cheers, > > > > Graham > > > > > > > > On Sep 10, 10:21 am, Pat Allan <[email protected]> wrote: > > > >> 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 -~----------~----~----~----~------~----~------~--~---
