hello pat,
I got into another issue while trying bundled search. Though i can
take care of it in my code, its worth mentioning to you.
TS complains " bad multi-query count 0 (must be in 1..32 range)" if
you are running a block mentioned below:
searches = ThinkingSphinx::Search.bundle_searches do |sphinx|
if 1 == 2
sphinx.search 'restaurants', :classes => [Model]
sphinx.search 'automobile', :classes => [Model]
end
end
tx
madhu
On Sep 2, 11:09 am, madhu <[email protected]> wrote:
> hi pat,
>
> I just modified bundled_search.rb and added this code there and it
> looks good. Am I good to go ? :)
>
> def search_for_ids(*args)
> @searches << ThinkingSphinx.search_for_ids(*args)
> @searches.last.append_to client
> end
>
> regards,
> madhu
>
> On Sep 2, 10:53 am, madhu <[email protected]> wrote:
>
> > hi pat,
>
> > Any leads :)
>
> > tx
> > madhu
>
> > On Sep 1, 4:16 pm, madhu <[email protected]> wrote:
>
> > > hi pat,
>
> > > I just downloaded the source code and copied to my plugin directory
> > > which is working out of the box. I haven't tried with git since I
> > > mailed you last time.
>
> > > Looks like 'search_for_ids' is not supported by bundle_searches.
>
> > > For example a query like this below doesn't work :
>
> > > searches = ThinkingSphinx::Search.bundle_searches do |sphinx|
> > > sphinx.search_for_ids'@(field1,field2):restaurants',:match_mode
> > > => :extended, :with => {:one => 1,:two=> 2}, :classes =>
> > > [Product],:index => "index_name"
> > > sphinx.search_for_ids'@(field1,field2):automobiles',:match_mode
> > > => :extended, :with => {:one => 1,:two=> 2}, :classes =>
> > > [Product],:index => "index_name"
> > > end
>
> > > Let me know if you have a solution for this :)
>
> > > regards,
> > > madhu
>
> > > On Aug 30, 7:24 pm, Pat Allan <[email protected]> wrote:
>
> > > > Sounds like Github is/was having issues - does it work now?
>
> > > > --
> > > > Pat
>
> > > > On 31/08/2010, at 9:15 AM, madhu <[email protected]> wrote:
>
> > > > > hi pat,
>
> > > > > git connection is timing out, i have tried couple of times :
> > > > > ruby script/plugin install git://github.com/freelancing-god/thinking-
> > > > > sphinx.git
>
> > > > > Initialized empty Git repository in /......./vendor/plugins/thinking-
> > > > > sphinx/.git/
> > > > > github.com[0: 207.97.227.239]: errno=Connection timed out
> > > > > fatal: unable to connect a socket (Connection timed out)
>
> > > > > regards,
> > > > > madhu
>
> > > > > On Aug 28, 12:24 am, Pat Allan <[email protected]> wrote:
> > > > >> Hi Madhu
>
> > > > >> I don't plan on changing the syntax, and will keep this code - it's
> > > > >> not temporary. I'm not sure when I'll release a new gem version -
> > > > >> I'd like to wait, see if any other bugs crop up (possibly in other
> > > > >> areas - I think this code is pretty stable, as I'm using it
> > > > >> internally myself, and the cucumber features are still green :)
>
> > > > >> Cheers
>
> > > > >> --
> > > > >> Pat
>
> > > > >> On 28/08/2010, at 4:18 PM, madhu wrote:
>
> > > > >>> FYI. its working fine for me. Is this a temporary fix ? do you
> > > > >>> foresee
> > > > >>> any issuues/limitations with this ? otherwise i want to put it in
> > > > >>> production :)
>
> > > > >>> I did some testing, and it looks good to me.
>
> > > > >>> Any plans to release it as a gem ?
>
> > > > >>> tx
> > > > >>> madhu
>
> > > > >>> On Aug 27, 11:20 pm, madhu <[email protected]> wrote:
> > > > >>>> thank you pat,
>
> > > > >>>> I will try it out shortly. My git installation is getting into
> > > > >>>> issues
> > > > >>>> one after another. Any plans to release it as a gem ?
>
> > > > >>>> tx
> > > > >>>> madhu
>
> > > > >>>> On Aug 27, 7:37 pm, Pat Allan <[email protected]> wrote:
>
> > > > >>>>> Right, obviously my implementation was not perfect.
>
> > > > >>>>> The reason for the array is because when I've been using it for
> > > > >>>>> facets, I'm looping over each facet tosearchfor. But as we've
> > > > >>>>> found out, that's not a good fit in every situation. So I've
> > > > >>>>> just pushed a commit that improves things - you may want to pull
> > > > >>>>> down the source, either as a plugin, or to run 'rake build' to
> > > > >>>>> build a new gem locally.
>
> > > > >>>>>http://github.com/freelancing-god/thinking-sphinx/commit/2f82bce33472
> > > > >>>>> ...
>
> > > > >>>>> So now, you should be able to do this:
>
> > > > >>>>> searches = ThinkingSphinx::Search.bundle_searches do |sphinx|
> > > > >>>>> sphinx.search'restaurants'
> > > > >>>>> sphinx.search'automobile'
> > > > >>>>> end
>
> > > > >>>>> It's probably not going to work with Model.searchcalls - but as
> > > > >>>>> a work-around for that, use the :classes option:
>
> > > > >>>>> searches = ThinkingSphinx::Search.bundle_searches do |sphinx|
> > > > >>>>> sphinx.search'restaurants', :classes => [Model]
> > > > >>>>> sphinx.search'automobile', :classes => [Model]
> > > > >>>>> end
>
> > > > >>>>> Cheers
>
> > > > >>>>> --
> > > > >>>>> Pat
>
> > > > >>>>> On 28/08/2010, at 3:43 AM, madhu wrote:
>
> > > > >>>>>> dear pat,
>
> > > > >>>>>> I just tried the code with a dummy array, but i have noticed
> > > > >>>>>> only the
> > > > >>>>>> lastsearchquery is getting executed and the return result set
> > > > >>>>>> have
> > > > >>>>>> always one array element
>
> > > > >>>>>> TS version have : thinking-sphinx-1.3.19
>
> > > > >>>>>> for example :
>
> > > > >>>>>> my_araay = ["dummy_one"]
> > > > >>>>>> results = ThinkingSphinx::Search.bundle_searches(myarr) do |
> > > > >>>>>> sphinx,
> > > > >>>>>> item_in_array|
> > > > >>>>>> mymodel.search"restaurants"
> > > > >>>>>> mymodel.search"automobile"
> > > > >>>>>> end
>
> > > > >>>>>> The end results is a something like this [[#<Product id:
> > > > >>>>>> 121,.....>,#<Product id: 122,.....>,#<Product id:
> > > > >>>>>> 123,.....>.....]]
>
> > > > >>>>>> The result containssearchresults for "automobile" (for this
> > > > >>>>>> example)
> > > > >>>>>> and there is always one one result set in the array. i was
> > > > >>>>>> expecting
> > > > >>>>>> something like this:
> > > > >>>>>> [ [#<Product id: 121,.....>,#<Product id: 122,.....>,#<Product
> > > > >>>>>> id:
> > > > >>>>>> 123,.....>.....],
> > > > >>>>>> [#<Product id: 124,.....>,#<Product id: 125,.....>,#<Product id:
> > > > >>>>>> 126,.....>.....]
> > > > >>>>>> ]
>
> > > > >>>>>> tx
> > > > >>>>>> madhu
>
> > > > >>>>>> On Aug 27, 10:59 am, madhu <[email protected]> wrote:
> > > > >>>>>>> sorry about the incomplete post before let me repeat my post :
>
> > > > >>>>>>> hello pat,
>
> > > > >>>>>>> Thank you for the swift reply. I a little confused about what
> > > > >>>>>>> should
> > > > >>>>>>> contain in the array ? Let me try with an example.
> > > > >>>>>>> mymodel = MyModel.new
> > > > >>>>>>> my_arr = [mymodel]
>
> > > > >>>>>>> ThinkingSphinx::Search.bundle_searches(my_arr) do |
> > > > >>>>>>> model_obj,what_is_this_element_for|
> > > > >>>>>>> model_obj.search"extendedsearchquery one",:index =>
> > > > >>>>>>> "index_name",:matchmode =>:extended
> > > > >>>>>>> model_obj.search"extendedsearchquery two",:index =>
> > > > >>>>>>> "index_name",:matchmode =>:extended
> > > > >>>>>>> end
>
> > > > >>>>>>> Is it some thing similar to the syntax above ? if so what is the
> > > > >>>>>>> second element for "what_is_this_element_for" in the array ?
> > > > >>>>>>> what
> > > > >>>>>>> should i fill that with ? and where is it used ? Do you think
> > > > >>>>>>> this is
> > > > >>>>>>> stable enough to go production ?
>
> > > > >>>>>>> tx
> > > > >>>>>>> madhu
>
> > > > >>>>>>> On Aug 27, 10:51 am, madhu <[email protected]> wrote:
>
> > > > >>>>>>>> hello pat,
>
> > > > >>>>>>>> Thank you for the swift reply. I a little confused about what
> > > > >>>>>>>> should
> > > > >>>>>>>> contain in the array ? Let me try with an example.
> > > > >>>>>>>> mymodel = MyMode.new
> > > > >>>>>>>> my_arr =
>
> > > > >>>>>>>> On Aug 27, 8:39 am, Pat Allan <[email protected]>
> > > > >>>>>>>> wrote:
>
> > > > >>>>>>>>> I've actually just added this recently - so make sure you're
> > > > >>>>>>>>> using the latest gem (or the latest source as a plugin).
>
> > > > >>>>>>>>> Keep in mind I've built this functionality to help speed up
> > > > >>>>>>>>> facet queries, so not sure how well it fits general use, but
> > > > >>>>>>>>> hopefully it does the job:
>
> > > > >>>>>>>>> ThinkingSphinx::Search.bundle_searches(array) do |sphinx,
> > > > >>>>>>>>> item_in_array|
> > > > >>>>>>>>> sphinx.search"condition_one condition_two"
> > > > >>>>>>>>> sphinx.search"condition_two"
> > > > >>>>>>>>> end
>
> > > > >>>>>>>>> That will return an array ofsearchresults... now, I can
> > > > >>>>>>>>> see that the array provided as an argument (and the
> > > > >>>>>>>>> subsequent yielding of each item) only works if you're
> > > > >>>>>>>>> naturally creating a set of queries from some kind of
> > > > >>>>>>>>> collection. So at this point, you *need* an array with
> > > > >>>>>>>>> something in it - otherwise, there's nothing to loop over,
> > > > >>>>>>>>> and your inner block won't run.
>
> > > > >>>>>>>>> You *should* be able to call #searchon the sphinx object as
> > > > >>>>>>>>> many times as you like, and it will queue up eachsearch
> > > > >>>>>>>>> (ie: you don't need to call it just once per yield).
>
> > > > >>>>>>>>> Anyway, see how you go, and let me know if you get stuck :)
>
> > > > >>>>>>>>> --
> > > > >>>>>>>>> Pat
>
> > > > >>>>>>>>> On 27/08/2010, at 2:52 PM, madhu wrote:
>
> > > > >>>>>>>>>> dear pat,
>
> > > > >>>>>>>>>> Is there a way to makebatchquery in TS ? For example:
>
> > > > >>>>>>>>>> 1) my first query is something like this "condition_one
> > > > >>>>>>>>>> condition_two"
> > > > >>>>>>>>>> 2) my second query is something like this "condition_one
> > > > >>>>>>>>>> condition_three"
>
> > > > >>>>>>>>>> Please note the "condition_one" remains the same in both
> > > > >>>>>>>>>> the places.
> > > > >>>>>>>>>> These queries are very complex extended queries.
>
> > > > >>>>>>>>>> When i contacted the excellent sphinx support team about
> > > > >>>>>>>>>> performance
> > > > >>>>>>>>>> improvement, they suggested me to run it inbatchqueries.
> > > > >>>>>>>>>> The PHP
> > > > >>>>>>>>>> code is something like this :
>
> > > > >>>>>>>>>> $cl->AddQuery(query1);
> > > > >>>>>>>>>> $cl->AddQuery(query2);
>
> ...
>
> read more »
--
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.