Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing the search bar still yields script template results #113

Closed
ctrueden opened this issue Oct 4, 2022 · 4 comments · Fixed by #264
Closed

Clearing the search bar still yields script template results #113

ctrueden opened this issue Oct 4, 2022 · 4 comments · Fixed by #264
Labels
bug Something isn't working
Milestone

Comments

@ctrueden
Copy link
Member

ctrueden commented Oct 4, 2022

Type a search string, then delete what you typed. There will still be results in the results box, specifically Script templates:

empty-search-string

@ctrueden ctrueden added the bug Something isn't working label Oct 4, 2022
@ctrueden ctrueden added this to the 1.0.0 milestone Oct 4, 2022
@gselzer
Copy link
Collaborator

gselzer commented Oct 4, 2022

This seems to be a problem with the Script templates Searcher, @ctrueden; it also happens in Fiji. Where is that Searcher located? It'd be best to move this issue there.

@ctrueden
Copy link
Member Author

I agree that we should fix it in the script template searcher. But it would also be good to have explicit handling here in napari-imagej to clear the results explicitly whenever the text field gets blanked out.

@gselzer wrote:

Where is that Searcher located?

#@ PluginService ps
from org.scijava.search import Searcher
for searcher in ps.getPluginsOfType(Searcher):
	print(searcher)
class='org.scijava.search.snippet.SnippetSearcher', priority=1000000.0, enabled=true, pluginType=Searcher
class='org.scijava.search.module.ModuleSearcher', priority=10000.0, enabled=true, pluginType=Searcher
class='net.imagej.ops.search.OpSearcher', priority=9999.0, enabled=true, pluginType=Searcher
class='org.scijava.search.template.TemplateSearcher', priority=9990.0, enabled=true, pluginType=Searcher
class='org.scijava.search.web.ImageJWikiSearcher', priority=100.0, enabled=false, pluginType=Searcher
class='org.scijava.search.classes.ClassesSearcher', priority=0.0, enabled=true, pluginType=Searcher
class='org.scijava.search.web.ImageScSearcher', priority=0.0, enabled=false, pluginType=Searcher

@gselzer
Copy link
Collaborator

gselzer commented Oct 13, 2022

But it would also be good to have explicit handling here in napari-imagej to clear the results explicitly whenever the text field gets blanked out.

I don't think it's that simple @ctrueden. Getting from search text to results is all done through event handlers, and we leave any search ordering up to the SearchOperation. Thus if we were to try to process different search texts diffrently (i.e. by handling an empty string search ourselves), we might break the search ordering and see weird behavior.

For example, suppose you start from a fresh terminal, and type f and then immediately clear the search bar. If we finish handling the empty string from clearing the bar before the searchOperation returns the results from searching f, we'll have search results with no search string.

As much as I'd like to handle clearing the search bar ourselves, it would take a lot of yucky refactoring to do so

@gselzer
Copy link
Collaborator

gselzer commented May 31, 2023

Once we clean up scijava/scijava-search#30, we should bump the "recommended" (not hard minimum) version of scijava-search, and this will be solved!

@gselzer gselzer linked a pull request Jun 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants