Jump to content

result sorting broken


Recommended Posts

Hey,

check this:

Bildschirmfoto_2014_01_11_um_16_23_07.pn

 

I dont know how und why, but the sorting seems to be a bit broken if I list this via my keyword (without argument required).

You can ignore all informations, only the numbers (array_index) are interesting: 39, 2, 1, 21, 0, 3, ... rest till 40 are fine. Only the first one are broken. 

 

Technical:

I am using PHP to parse a JSON to array. Davids workflows function does the rest.

OS X 10.9.1

Alfred latest (2.1.1 [227])

Workflows.php v0.3.3 by David Ferguson

 

 

Does someone knows this issue?

Link to comment

There are two reasons this could occur:

  1. Your script is returning results in the wrong order. If your results don't have Unique IDs (UID), Alfred will sort them in the order they are given by your code.
  2. Your results have Unique IDs. Alfred will remember these UIDs and put frequently-used results at the top.

Could you post the workflow? That would make debugging simpler.

 

I'm 99.9% sure this is not a bug. I've been using Alfred's intelligence for a while and never had any issues.

Link to comment

1st: Thanks for your answer!

 

  1. Your script is returning results in the wrong order. If your results don't have Unique IDs (UID), Alfred will sort them in the order they are given by your code.

The JSON I parse has the right order, so my array has it also I think. Due to "foreach ($s as $key => $sele)" Alfred should handle the order because $key (array-index) represents the UID.

 

 

        2. Your results have Unique IDs. Alfred will remember these UIDs and put frequently-used results at the top.

Yes, I use UIDs (s.a.) but Alfred got new UIDs after the method fires. You can see the UIDs also in the screenshot (39, 2, 1, ...). Strange :-/

The broken lines are always the same: 1st line in result list = last entry. Line 2-5 are mixed. Line 6-40 are correct. Check my screenshots again.

 

 

Could you post the workflow? That would make debugging simpler.

Ofc! Workflow: DOWNLOAD
Edited by eusi
Link to comment

 

Yes, I use UIDs (s.a.) but Alfred got new UIDs after the method fires. You can see the UIDs also in the screenshot (39, 2, 1, ...). Strange :-/

The broken lines are always the same: 1st line in result list = last entry. Line 2-5 are mixed. Line 6-40 are correct. Check my screenshots again.

 

 

As Tyler said, leave the UID field empty in the XML and then you have control of your sort order otherwise Alfred will try to re-sort to any previously matching UIDs.

 

[moving to the workflow help sub-forum, but will keep an eye on this]

Link to comment

As Tyler said, leave the UID field empty in the XML and then you have control of your sort order otherwise Alfred will try to re-sort to any previously matching UIDs.

Ah ok, now I got it. Yes you both are right. If I delete the UID the sort order is correct. 

 

It was a misunderstanding by myself. I thought, if I give Alfred the array-index (correct sort order) as UID, so he will sort the list with this index correct. But he didnt need it ^^ 

 

Thanks again Tyler and Andrew!

Edited by eusi
Link to comment

Yeah, the learning feature that Alfred has is brilliant, but it gets in the way a bit for workflow developers. The blank uid's are the way to go, and then you can make sure everything is sorted correctly via your own code, which is pretty nice because you can come up with whichever complex sorts that you want.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...