Jump to content

Inconsistent ordering of results from script filter xml


nathan11g
 Share

Recommended Posts

I am making a workflow that uses a script filter. The keyword is "date", a space is required, and the argument is optional.

 

The script returns xml with 4 <item>s, and the items include uids. The uids correspond to different date formats, and do not depend on the arguments given.

 

I am expecting Alfred to use the uids to put the more recently used date formats at the top. This is mostly true, but with one problem. It appears that Alfred is tracking two sets of usage data, one for the keyword with arguments and another for the keyword without arguments. So if I type "date", it shows at the top the date format that I usually pick when not using arguments, whereas if I type "date [some argument]" it shows me the date format that I pick when using arguments. This causes undesirable shuffling of result rows.

 

If the issue is unclear, let me know and I can add a video or something.

Link to comment
Share on other sites

I am making a workflow that uses a script filter. The keyword is "date", a space is required, and the argument is optional.

 

The script returns xml with 4 <item>s, and the items include uids. The uids correspond to different date formats, and do not depend on the arguments given.

 

I am expecting Alfred to use the uids to put the more recently used date formats at the top. This is mostly true, but with one problem. It appears that Alfred is tracking two sets of usage data, one for the keyword with arguments and another for the keyword without arguments. So if I type "date", it shows at the top the date format that I usually pick when not using arguments, whereas if I type "date [some argument]" it shows me the date format that I pick when using arguments. This causes undesirable shuffling of result rows.

 

If the issue is unclear, let me know and I can add a video or something.

 

Could you post a link to a workflow exhibiting this behaviour?

Link to comment
Share on other sites

Sorry for the delay, I thought I had email notifications on.

 

Here is an example workflow: http://orbt.io/P1oG.alfredworkflow

 

 

Train it a while by typing "grigg" and selecting the top item, and then typing "grigg foo" and selecting item 2. For me, it took about 5 of each to exhibit the problem.

 

Once it is trained, then when you type "grigg" you will see the items in one order and as soon as you begin typing an argument, the order will switch.

Link to comment
Share on other sites

I had the same 'problem' when i was working on a workflow. I hoped i was able to use the uids to achieve a smart suggestion set. And the more i understood, the more it became clear that it wasn't going to help me. because of the following reason:

 

The uid based suggestions are linked to full queries so they will remember the result i picked for workflow and remember a different suggestion for workflow myquery , which - if you'd make a static workflow showing a list of items - makes perfect sense. The reality 'especially with script filters' is that you end up influencing the order by the way your script works too.

 

For that reason I ended up not using the uid by setting it to a static string. Now i just control which ones are shown first, based on matching the query in combination with a little cache file counting the results based on an internal id.

 

Not sure if I'm still making sense, but the conclusion is that it's working as expected.. but it's probably not working with your script structure.. do you have an example that shows what your 'real' workflow looks like?

 

ps. I'm just an enthousiast, no Alfred crew member or anything.

Link to comment
Share on other sites

I agree that leaving out the uid is a good workaround, giving you full control over the order things are listed.

 

I'm still suspicious that the developers intend the order listing to depend on uid _and_ query string (or possibly just the existence of query string, I can't tell). It seems like depending only on the uid would be more flexible.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...