kiwix-android icon indicating copy to clipboard operation
kiwix-android copied to clipboard

Should be able to easily open article with exact name

Open danielzgtg opened this issue 4 years ago • 13 comments

Describe the bug

It is very hard to search for things like the word "a" in Kiwix.

While this most visibly affects the word "a," it affects most short words in Wiktionary.

Kiwix is using the query as a prefix but not making sure the exact match is the first result. This was unusable on 3.2 when the search results were limited, but even though it is possible to open the word "a" now on 3.3, I need to scroll down a lot and find a needle in a haystack.

On Kiwix Linux I can press enter to go to an article with the exact name, but on Android pressing the search (enter) button in GBoard only dismisses it.

Expected behavior

  • ~~The exact match to always be the first search result.~~
  • ~~Enter button on keyboard open the article with the exact name, just like on Kiwix Linux~~
  • Some way to easily open an article using its exact name

Steps to reproduce the behavior:

  1. Open wiktionary_en_all_maxi_2020-01.zim
  2. Enter "a" in search
  3. Spend a lot of time trying to find the definition for "a"

Screenshots

Hard to find the definition for "a" in Kiwix Android (no sorting, and broken enter key):

Screenshot_20200426-025030

Easy to find the definition for "a" on official Wiktionary website (sorted, and working enter key):

image

Environment

  • Version of Kiwix Android : 3.3.0
  • Device : OnePlus 7 Pro
  • OS version : OxygenOS Beta 11

danielzgtg avatar Apr 26 '20 06:04 danielzgtg

I would like to work on this

danielzgtg avatar Apr 26 '20 08:04 danielzgtg

Here is a video of my preliminary implementation of the exact article opening when the search button on GBoard is pressed:

kiwixexactsearch_202004261216410001.mp4.zip

danielzgtg avatar Apr 26 '20 16:04 danielzgtg

Enter button on keyboard open the article with the exact name, just like on Kiwix Linux

I don't think this is a good idea, enter on a search field is meant to be submit aka fetch me results for this, right now we ignore this because we already search for data on each input.

macgills avatar Apr 27 '20 08:04 macgills

This is how it works on the official Wikipedia website. Most people who use Wikipedia, whether they also use Kiwix or not, would expect this behavior. The enter button can mean "submit," but it can also mean "I'm feeling lucky."

It actually doesn't matter how the underlying problem is solved. I don't care that much (only a little bit about consistency between Android/Linux) about how I am able to open the article with the exact name. I want to be able to give Kiwix an exact article title, and be able to tell Kiwix to open it without too many taps.

danielzgtg avatar Apr 27 '20 08:04 danielzgtg

We are not Wikipedia though, the app is most analogous to a browser and when I tap submit on a search in chrome it searches for it, though I guess if you address a webpage specifically it also goes to it. There could also be the issue where searching takes a long time to load (haven't witnessed it but there have been reports) where an "I'm feeling lucky" would be an ambiguous input.

If the search results are reordered so an exact match is at the top then it is 1 click away after a user has completed desired input, I think that will be sufficient. Thanks for adding this functionality

macgills avatar Apr 27 '20 09:04 macgills

@macgills @danielzgtg I would just like to have more time to think about that more in details. To a certain extend, what @danielzgtg asks for is how kiwix-serve and kiwix-desktop works.

kelson42 avatar Apr 27 '20 09:04 kelson42

what @danielzgtg asks for is how kiwix-serve and kiwix-desktop works

This is exactly what I was trying to say.

Initially, it might have been confusing how I mixed up the titles for the issue/PR, but I fixed them later. I had come up with the ideas for both at the same time.

Going from Desktop to Android, I miss the ability to easily open an article by its exact name. This issue+PR is just requesting the feature to be ported.

danielzgtg avatar Apr 29 '20 21:04 danielzgtg

Well I am very much in favour of the current PR to move the exact match to the top, we can await kelson's decision before going any further

macgills avatar Apr 30 '20 08:04 macgills

in favour of the current PR to move the exact match to the top

Meanwhile, I have become only weakly in favor of it. I took a lot of the stuff I wanted out of that PR, such as sorting when kelson mentioned how that kind of logic belonged in libkiwix, as well as the enter button support after it was separately discussed from the rest of the PR.

Even the code that moves the exact match to the top might be moved to libkiwix. That would leave only the tests (which are important) in the PR. As an aside, while we are moving things to libkiwix, we could also move the distinct search result code out of the Android part.

kelson's decision before going any further

Indeed. Note that I actually went backwards (i.e. removed stuff) with regards to the PR and the rest is just responding to reviews.

I removed the word "Fixes" from the PR as its now only one of potentially three parts for this issue. The other two parts still remain unwritten, awaiting kelson's decision as to where, whether, and how to implement the sorting and enter button features

danielzgtg avatar Apr 30 '20 11:04 danielzgtg

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Jun 30 '20 16:06 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Oct 17 '20 02:10 stale[bot]

@kelson42 I am testing this ticket with #3217.

@danielzgtg asks for is how kiwix-serve and kiwix-desktop works.

@mgautierfr confirms that kiwix-server using the SuggestionSearch all the time and we also now use the SuggestionSearch in Android code. I have tested it, and the results we are searching for are now showing the same results that we have searched for, which is the aim of this ticket.

1691756752219

MohitMaliFtechiz avatar Aug 11 '23 12:08 MohitMaliFtechiz

See https://github.com/kiwix/libkiwix/issues/748

mgautierfr avatar Aug 11 '23 14:08 mgautierfr

@MohitMaliFtechiz I believe the essence of this ticket is a duplicate of https://github.com/kiwix/kiwix-android/issues/2896 and has been implemented actually? What do you think?

kelson42 avatar Feb 26 '24 07:02 kelson42

@kelson42 I agree with you.

The exact match to always be the first search result. Enter button on keyboard open the article with the exact name, just like on Kiwix Linux Some way to easily open an article using its exact name

We have a ticket for the first point in libzim https://github.com/openzim/libzim/issues/766. For the other two points, we have implemented in https://github.com/kiwix/kiwix-android/issues/2896 (if the article is found with the exact name then kiwix opens that article). Also we have improved our press Enter to skip the search functionality in https://github.com/kiwix/kiwix-android/pull/3722, which ensures that the search result is exactly what we have searched. Which is the aim of this ticket.

Edited: We can close this issue once https://github.com/kiwix/kiwix-android/pull/3722 merged.

MohitMaliFtechiz avatar Feb 27 '24 12:02 MohitMaliFtechiz