#76 ✓moved_to_github
ramesh

Sorting on a single table Help

Reported by ramesh | March 29th, 2009 @ 09:42 PM

I tried out using the example code on my controller i.e @search = new_search(params[:search]) and I am able to sort and view pages in 10, 25 etc.. However, when I add conditions the data is displayed correctly but the sorting and page links don't work. I am trying this on a single table of data. Your comments and advised would be helpful.

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson March 30th, 2009 @ 11:47 AM

    • State changed from “new” to “open”

    I have no idea. Can you please create a failing test, and then I can fix the issue. By test, I mean a test I can run in the searchlogic test suite. I apologize for asking you to do this, but its a new policy I am implementing with my open source projects. I am just very busy and this would help me easily knock out the issue.

  • ramesh

    ramesh March 31st, 2009 @ 07:44 AM

    Wilco, but I need time, since I am a newbie

  • ramesh

    ramesh April 1st, 2009 @ 09:52 AM

    Will this help ?

    When I use :- "@search = ArdData.new_search(params[:search]);" in the controller the sql generated on sorting any column is :- "Processing ArdDataController#index (for 127.0.0.1 at 2009-04-01 18:01:17) [GET] Parameters: {"search"=>{"order_as"=>"ASC", "order_by"=>"stock"}} ArdData Columns (2.1ms) SHOW FIELDS FROM ard_datas ArdData Load (0.2ms) SELECT * FROM ard_datas ORDER BY ard_datas.stock ASC LIMIT 25 SQL (0.1ms) SELECT count(ard_datas.part_number) AS count_part_number FROM ard_datas Rendering ard_data/index Completed in 46ms (View: 23, DB: 3) | 200 OK [http://localhost/ard_data?search...]"

    Here I have tried sorting on the "Stock" column. This works for other columns also.

    When I use:-

    "@search = ArdData.new_search(:conditions => {:store_type => 'DOR', :cpq_category => 'P'});" in the controller the sql generated on sorting any column is :-

    "Processing ArdDataController#index (for 127.0.0.1 at 2009-04-01 19:24:09) [GET] Parameters: {"search"=>{"order_as"=>"ASC", "order_by"=>"stock"}} ArdData Columns (2.1ms) SHOW FIELDS FROM ard_datas ArdData Load (0.2ms) SELECT * FROM ard_datas WHERE (ard_datas.cpq_category = 'P' AND ard_datas.store_type = 'DOR') LIMIT 25 SQL (0.6ms) SELECT count(ard_datas.part_number) AS count_part_number FROM ard_datas WHERE (ard_datas.cpq_category = 'P' AND ard_datas.store_type = 'DOR') Rendering ard_data/index Completed in 73ms (View: 28, DB: 3) | 200 OK [http://localhost/ard_data?search...]"

    The difference I see is in the "ArdData Load". The first query(no conditions) has a "ORDER BY" clause whereas the second(with conditions) doesn't.

  • Ben Johnson

    Ben Johnson July 30th, 2009 @ 02:55 AM

    Sorry for the lack of activity, is this still an issue. It looks like this bug is for the older version of searchlogic.

  • Ben Johnson

    Ben Johnson August 7th, 2009 @ 06:30 PM

    • State changed from “open” to “moved_to_github”

    [state:"moved_to_github" bulk edit command]

  • seomaster

    seomaster April 11th, 2021 @ 04:24 AM

    It is somewhat fantastic, and yet check out the advice at this treat. visit this page

  • seomaster

    seomaster April 14th, 2021 @ 06:41 AM

    I should say only that its awesome! The blog is informational and always produce amazing things. online casino

  • seomaster

    seomaster May 8th, 2021 @ 11:18 PM

    It is fine, nonetheless evaluate the information and facts around this correct. online casino uk

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages