Reply to topic

Avoiding insertion of multiple identical matches in KRunner

Bakuriu2
Registered Member
Posts
2
Karma
0
I'm developping a python Runner for KRunner and it works fine, except that multiple matches for identical items are shown.
The runner searches into a database some results based on a list of "tags" provided by the user.

For example if the user digits "searching, array" the runner will look into the database and find the results that have those tags.
The problem is that when the user writes "searching" a certain number of matches is show and when it adds ", array" some other matches are added,
even though they are already present in KRunner's result list.

I've tried to set a unique id for the QueryMatches but it does not work. I tried to use RunnerContext.match(id_str) to see whether there is already a matching item but it always return an invalid QueryMatch. Also calling RunnerContext.matches() will always return an empty list, no matter what.

How can I avoid this behaviour? I thought the runner checked the ids of the matches and automatically avoided inserting duplicate matches, but it clearly does not do this.
User avatar einar
Administrator
Posts
2288
Karma
5
OS
Is your code available somewhere? I might take a look.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
Bakuriu2
Registered Member
Posts
2
Karma
0
You may find the source code on bitbucket:
https://bitbucket.org/bakuriu/pseudocoderunner/src

The relevant file is contents/code/pseudocode/runner.py.

You may create a database of examples running contents/data/examples.py adding contents/code to the PYTHONPATH. If you try to run the plug-in and digit for example "linear" you'll see two identical matches showing up(one is generated looking up the linear tag and one looking up the title).
Bakuriu
Registered Member
Posts
1
Karma
0
I've managed to avoid insterting duplicated item. Badsically before adding the matches to the runner I manually scan them and remove duplicates.
I'm still interested if there is a way of avoiding this "by hand".
User avatar bcooksley
Administrator
Posts
18669
Karma
83
OS
You might want to try asking on plasma-devel@kde.org about that..


System Settings and Device Actions KCM maintainer
Image

 
Reply to topic

Bookmarks



Who is online

Registered users: Alastair, apater, Baidu [Spider], Bing [Bot], Exabot [Bot], garthecho, ggael, Google [Bot], google01103, Horus, jitseniesen, Joif, kde-jriddell, ken300, La Ninje, Mamarok, mmistretta, Nuc!eoN, psbot [Picsearch], rbruce, renatoatilio, sacarde, sinclair, stephans, TheraHedwig, tienhung, wolfi323, Yahoo [Bot]