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

as_pool_build_search_tokens strips off last character #361

Closed
robert-ancell opened this issue Oct 1, 2021 · 7 comments
Closed

as_pool_build_search_tokens strips off last character #361

robert-ancell opened this issue Oct 1, 2021 · 7 comments

Comments

@robert-ancell
Copy link
Contributor

The following program:

   g_autoptr(AsPool) pool = as_pool_new ();
   g_auto(GStrv) tokens = as_pool_build_search_tokens (pool, "evince");
   for (guint i = 0; tokens[i] != NULL; i++) {
      g_printerr ("%s\n", tokens[i]);
   }

Prints out evinc, which seems to indicate the last character is being dropped from search terms.

@robert-ancell
Copy link
Contributor Author

FYI @pwithnall - I noticed this in gnome-software and followed it to appstream.

@pwithnall
Copy link
Contributor

(Note that @robert-ancell might not be available for the next week to follow up on this)

@pwithnall
Copy link
Contributor

This is likely the result of stemming (as-stemmer.c)

@ximion
Copy link
Owner

ximion commented Oct 1, 2021 via email

@pwithnall
Copy link
Contributor

@robert-ancell did you notice this as the result of a misbehaviour in gnome-software, or just coincidentally?

@robert-ancell
Copy link
Contributor Author

I noticed this specifically when debugging searches in the snap plugin. When you search for evince only "evinc" is passed to the plugin. I thought this was initially the last keypress not being detected in the search entry, but then found it was this function that was causing the issue.

The search tokens are built in gs-plugin-loader.c, if they're supposed to drop information should that be done at a later stage?

@ximion
Copy link
Owner

ximion commented Nov 16, 2021

@robert-ancell I think that really depends on the description of GS' plugin API: Are the plugins supposed to get preprocessed (and thereby stemmed) search tokens, or are they supposed to get the raw input submitted by the user?
I think an argument could be made for both, the former is more efficient, the latter is more flexible as some plugins may want their own stemming.
In any case, this isn't an issue in AppStream, that pretty much works as intended as we do want stemmed search terms.

@ximion ximion closed this as completed Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants