
[Feature Request] Custom keywords
Pegoth opened this issue ยท 6 comments
I would like to add my own keywords pragmatically.
If I modify the CheckItem.lua
to add the following:
function Syndicator.Search.AddKeyword(keyword, check, group, force)
if force then
keyword = Syndicator.Search.CleanKeyword(keyword)
KEYWORDS_TO_CHECK[keyword] = nil
local i = 1
while i <= #KEYWORD_AND_CATEGORY do
if KEYWORD_AND_CATEGORY[i].keyword == keyword then
table.remove(KEYWORD_AND_CATEGORY, i)
else
i = i + 1
end
end
end
AddKeyword(keyword, check, group)
end
(I added force
to remove already existing keyword with that name.)
It seems to work and adds a keyword if I call it like this:
local function Example(details)
return C_Item.IsItemKeystoneByID(details.itemID)
end
Syndicator.Search.AddKeyword("example", Example, nil, true)
So it would be nice to have it as an API (I can do a PR if you would like).
However, it seems like whatever I do the result is cached if I return either true or false, meaning I have to do a /reload
to re-run the function. Calling the Syndicator.Search.ClearCache
method did not help.
At least 99% of use cases work with the current search system. Do you have an example of how you'd use the API?
The search will already scan tooltips and process a myriad selection of item properties and you can combine search terms with &
, |
, (
, )
and invert them with !
.
Is there a specific search you want to do but can't with the current Syndicator?
I like to add custom categories for various stuff and this would solve the issue without me needing to manually add each item to the specific category (in Baganator), so I could create a keyword with this API and then create a new category with another API in the Baganator and link the two by the "search" field (I'm currently writing an another issue for Baganator to be able to create categories from API).
Edit, for the issue created: Baganator/Baganator#202
As far as I'm concerned the search is already so complete as to not need an API. If you have a specific generic search term needed to create your category please submit it as a PR so everyone can use it.
I don't know why you are so against 10 rows of code. I even offered to write it and do a PR.
Edit: Never mind, I'll just do the PR, if you REALLY don't want this feature just reject it.
The reason is simple, I don't want to be placed in the position of processing support requests for broken categories or search because someone installed a broken or conflicting plugin, which is an inevitability, or maintaining interfaces that will impact future feature development.