I just upgraded from 1.4 to 1.5 and added a new index to solr. The ability to add new sort fields went away in 1.5. I then upgraded to the latest dev version and the issue remained.

Going back to 1.4 solved the problem.

I then went through each commit from 1.4 to 1.5 and found that this patch ( draggable table sort is not respected on searchapi sorts admin page (2168301) ) created the issue. Specifically this block of code:

// Order fields according to sorts weight.
    $new_fields = array();
    foreach ($sorts as $key => $sort) {
      if (!empty($fields[$key])) {
        $new_fields[$key] = $fields[$key];
      }
    }
    $fields = $new_fields;

I commented it out and everything started working again. It lost the sorting ability on the admin table but I could add new sort fields. Just to be sure I un-commented it after adding a few sort fields and those existing fields remained and sorted but all of the other potential sort fields were missing.

I have run out of time to figure out the fix, but commenting this out or removing it fixes the admin issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wilei’s picture

I can confirm this bug. New index and no fields shown as sortable when using searchapi_sorts-7.x-1.5. After commenting those few lines out all sortable fields are shown.

Anonymous’s picture

Thanks will look into ASAP.

vintorg’s picture

Commenting out that block of code solved my issue: https://drupal.org/node/2213849

I now have fields show up in my table under the sorts tab.

philipz’s picture

This patch makes those fields visible and they can be added but the order cannot be saved. This might be some other issue but I'm not sure.

Anonymous’s picture

Status: Active » Fixed
setvik’s picture

Priority: Major » Critical
Status: Fixed » Needs review
FileSize
579 bytes

Don't think this is fixed in latest dev yet.

Briefly tested the attached patch and it seems to work.
It should honor order of existing sort fields and allow new fields to be added.

criz’s picture

Bug confirmed. Highly critical, as it is also included in latest commerce kickstart release.

Patch #6 works for me.

malberts’s picture

Patch #6 works for me too.
I tried it with the latest Commerce Kickstart 2.14 (using Sorts 1.5) and with a custom build using Sorts 1.5 and Sorts dev.

Exploratus’s picture

#6 worked for me. This really should get committed, dont really understand how such an important module can have such a critical bug outstanding for so long. It's unusable without it.

Anonymous’s picture

Status: Needs review » Needs work

I can't apply patch #6 to latest dev-x, seems different code.

  • Commit 4c74258 on 7.x-1.x by morningtime:
    Issue #2202093 by Ravenight: sort saving issue.
    
Dr.Osd’s picture

#6 worked for me.

tamnv’s picture

#6 worked for me. Thanks

joelpittet’s picture

Status: Needs work » Fixed

Fixed as of #11

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dysrama’s picture

How has this still not been put in a new release? The module effectively doesn't work for first time installs.

mouthofthesea’s picture

Patch #6 works for me.

Quote for dysrama.

Please put this patch in a new release, so you can save potentially a lot investigation time for the future developer that have to face with that problem.

Have a good day!

jennypanighetti’s picture

Oh geez, this took me hours to fix! PLEASE post a new release with this patch!

Bill Choy’s picture

Please create a new release with this patch. Its been over a years

evaldask’s picture

ho ho.. some valuable hour wasted too :D

MariaWebIdeas’s picture

#6 is perfect, thanks.

sawtell’s picture

This is still not in a full release...
+1 for wasted time

Shashwat Purav’s picture

#6 Worked for me.

Aambro’s picture

#6 Worked for me. Using Commerce Kickstart 2 7.x-2.22

Martijn de Wit’s picture

Status: Closed (fixed) » Needs review

In version 7.x-1.6 the code is removed as the start post mentioned as temporary solution.

Why is the patch of #6 not applied instead ?!? Almost everybody mentioned that #6 was tested and worked.

#6 is also working fine for our installations.

StryKaizer’s picture

Status: Needs review » Postponed (maintainer needs more info)

@Martijn de Wit #11 was commited in 1.6 and solves the issue. I can not reproduce the issue anymore since this was commited.

#14 also states that commit from #11 solved the issue for him.

If you still experience this issue with 1.6, can you provide me details on how to reproduce the issue, as I can not reproduce it myself.

EDIT: nevermind: I can reproduce the issue, fixing this in dev

fox_01’s picture

#6 worked for me

StryKaizer’s picture

can somebody please tell me what issue you still experience even when 1.6 is active?

If I can reproduce it, I can include #6 or similar in the next version, but at this moment I can not reproduce the issue described in the issue summary.

EDIT: nevermind: I can reproduce the issue, fixing this in dev

  • StryKaizer committed 3e84d11 on 7.x-1.x authored by setvik
    Issue #2202093 by setvik: Search API Sorts Inability to add new sort...
  • StryKaizer committed e9e845f on 7.x-1.x
    Revert "Issue #2202093 by Ravenight: sort saving issue."
    
    This reverts...
fox_01’s picture

I had first installed 1.6 and saw nothing at the sorts tab.

StryKaizer’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks all for your patience. The previous maintainer was not active any more, which made this issue a bit longer outstanding.

Committed, will be in 1.7 and now available in dev.

fox_01’s picture

I tried to upgade by drush

File search_api_sorts-7.x-1.x-dev.tar.gz_date=1450822739 is corrupt (wrong md5 checksum).[error]

StryKaizer’s picture

I tried to upgade by drush

fox_01, can you give me the command on how you did that upgrade?

I just ran "drush dl search_api_sorts-7.x-1.x-dev", which works without issues.

fox_01’s picture

i have installed 1.5 and executed "drush up -y search_api_sorts-7.x-1.x-dev"

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.