After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 732344 - search-provider: Make "brno weather" work
search-provider: Make "brno weather" work
Status: RESOLVED OBSOLETE
Product: gnome-weather
Classification: Applications
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GNOME Weather Maintainer(s)
GNOME Weather Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-06-27 13:45 UTC by Debarshi Ray
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
search-provider: Fix typo (1.41 KB, patch)
2014-06-27 18:32 UTC, Debarshi Ray
accepted-commit_now Details | Review
search-provider: Support search keywords (2.37 KB, patch)
2014-06-27 18:33 UTC, Debarshi Ray
reviewed Details | Review
search-provider: Optimize use of normalizeCasefoldandUnaccent (2.13 KB, patch)
2014-06-27 18:42 UTC, Debarshi Ray
accepted-commit_now Details | Review
search-provider: Fix typo (1.58 KB, patch)
2014-06-28 08:44 UTC, Debarshi Ray
committed Details | Review
search-provider: Support search keywords (2.27 KB, patch)
2014-06-28 18:08 UTC, Debarshi Ray
none Details | Review

Description Debarshi Ray 2014-06-27 13:45:47 UTC
The idea is to make it work like Google. You type "$NAME_OF_PLACE weather" in gnome-shell and you should get the weather information. Ofcourse, just typing "brno" also works, but then I get other crap in the search results like PDFs of bus or aeroplane tickets from gnome-documents, nautilus, etc. and that pushes the weather information somewhere beyond the first page making it less useful than just using Google.

What I am suggesting is that the gnome-weather search-provider should always match keywords like 'temperature' and 'weather'. In most cases this will be good enough to just show the weather information and get rid of all the crap.

We can do this for almost all the search providers out there. Say 'documents' for gnome-documents, 'time' for gnome-clocks, etc..

We can go one step further and have all the search providers register these keywords to gnome-shell, which can then use them to sort the search results more cleverly. So even if 'brno weather' returns some other hits, it can put the results from gnome-weather at the top.
Comment 1 Debarshi Ray 2014-06-27 18:32:58 UTC
Created attachment 279428 [details] [review]
search-provider: Fix typo
Comment 2 Debarshi Ray 2014-06-27 18:33:35 UTC
Created attachment 279429 [details] [review]
search-provider: Support search keywords
Comment 3 Debarshi Ray 2014-06-27 18:42:16 UTC
Created attachment 279430 [details] [review]
search-provider: Optimize use of normalizeCasefoldandUnaccent
Comment 4 Giovanni Campagna 2014-06-27 20:07:14 UTC
Review of attachment 279428 [details] [review]:

Ugh, definitely
Comment 5 Giovanni Campagna 2014-06-27 20:08:26 UTC
Review of attachment 279429 [details] [review]:

::: src/service/searchProvider.js
@@ +53,3 @@
 
+    _isKeyword: function(str) {
+        if (Util.normalizeCasefoldAndUnaccent('forecast').indexOf(str) >= 0 ||

The result of Util.normalizeCasefoldAndUnaccent on a lowercase ASCII string is the string itself...
Comment 6 Giovanni Campagna 2014-06-27 20:10:12 UTC
Review of attachment 279430 [details] [review]:

Mh, good idea!

We should probably keep the normalized-casefolded-unaccented strings for the locations in the model too.
Besides, libgweather has get_sort_name() which almost does what we want (and we should probably extend
to the usual normalize-casefold-unaccent dance).
Not a blocker for this patch, though, just suggestions for the future.
Comment 7 Bastien Nocera 2014-06-27 21:16:16 UTC
Review of attachment 279430 [details] [review]:

g_str_match_string() instead of normalizeCasefoldAndUnaccent?
Comment 8 Bastien Nocera 2014-06-27 21:18:04 UTC
Review of attachment 279428 [details] [review]:

Mention what the typo is in the commit message?
Comment 9 Debarshi Ray 2014-06-28 08:26:31 UTC
(In reply to comment #7)
> Review of attachment 279430 [details] [review]:
> 
> g_str_match_string() instead of normalizeCasefoldAndUnaccent?

Yes, I intend to do that too. I remember seeing this normalizeCasefoldAndUnaccent in a few other modules too, so I will replace all of them one by one in subsequent patches.
Comment 10 Debarshi Ray 2014-06-28 08:44:14 UTC
Created attachment 279460 [details] [review]
search-provider: Fix typo

Try to describe the typo that we are trying to fix.
Comment 11 Debarshi Ray 2014-06-28 18:08:45 UTC
Created attachment 279504 [details] [review]
search-provider: Support search keywords
Comment 12 Paolo Borelli 2014-08-11 16:26:01 UTC
Review of attachment 279504 [details] [review]:

::: src/service/searchProvider.js
@@ -52,2 +52,4 @@
     },
 
+    _isKeyword: function(str) {
+        if ('forecast'.indexOf(str) >= 0 ||

These keywords need to be translated.

It is probably better to put them in a single comma separated string, since different languages may have a different number of terms and synonyms they want to match
Comment 13 Debarshi Ray 2014-12-09 19:13:58 UTC
The patch in this bug has bit-rotten a bit since gnome-weather underwent a redesign. I filed bug 741307 for another way to achieve this before I pick this up again.
Comment 14 GNOME Infrastructure Team 2021-07-05 10:59:36 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/gnome-weather/-/issues/

Thank you for your understanding and your help.