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

[Bug]: Category search times out or returns nothing. #5620

Open
adambuchbinder opened this issue Mar 12, 2024 · 12 comments
Open

[Bug]: Category search times out or returns nothing. #5620

adambuchbinder opened this issue Mar 12, 2024 · 12 comments
Labels

Comments

@adambuchbinder
Copy link

Summary

In the upload flow, the Category search does not bring anything up, regardless of the search text entered. There's no error message either.

Steps to reproduce

  1. Open the app.
  2. Upload a picture.
  3. At the Category page, enter some search text.
  4. Wait.

Expected behaviour

Some categories should appear as options.

Actual behaviour

The list of categories is blank.

Device name

Google Pixel 5a

Android version

Android 14

Commons app version

4.2.1~14b6c455b

Device logs

No response

Screen-shots

No response

Would you like to work on the issue?

Prefer not

@kanahia1
Copy link
Contributor

kanahia1 commented Mar 13, 2024

Hey @adambuchbinder, Thank you for reporting the issue.

I tested it on my device and on version 4.2.1~14b6c455b. It is working fine for me.

WhatsApp.Video.2024-03-13.at.10.00.08_f39a7f0b.mp4

@nicolas-raoul
Copy link
Member

@adambuchbinder Does that always happen, or just sometimes?

@rohit9625
Copy link
Contributor

I also experienced this several days before and thought it might be due to the unavailability of categories for some text. However, I did not recall for which text the category was blank in my case.
@adambuchbinder can you tell us which category you searched for?

@adambuchbinder
Copy link
Author

It doesn't matter what I search for; nothing shows up in the category box. See the video. (Too large to attach, on mobile so can't reencode.)

https://photos.app.goo.gl/q7fP7nqLyNG79Y3RA

@nicolas-raoul
Copy link
Member

When a technical error happens here we should display a snackbar with the message.

Even when the reason is that there is no internet, we do not show any error message:

screen-20240315-103939.mp4

@rohit9625
Copy link
Contributor

rohit9625 commented Mar 16, 2024

When a technical error happens here we should display a snackbar with the message.

Even when the reason is that there is no internet, we do not show any error

What is the cause that categories are not being fetched? Did you find anything in the logs?

@adambuchbinder
Copy link
Author

Sorry, I'm not familiar with some of the workflows here. How do I look at the logs to find out why categories aren't being fetched?

@mnalis
Copy link
Contributor

mnalis commented Apr 13, 2024

How do I look at the logs to find out why categories aren't being fetched?

@adambuchbinder in main menu, Settings, Send log file you can get the logs.

@adambuchbinder
Copy link
Author

Thank you for your patience; here's what looks like the relevant log.


2024-04-12 01:45:17,107     [ERROR] [file-logging-thread-1] [CategoriesPresenter$onAttachView] : android.database.sqlite.SQLiteException: no such column: description (code 1 SQLITE_ERROR): , while compiling: SELECT _id, name, description, thumbnail, last_used, times_used FROM categories ORDER BY last_used DESC
	at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
	at android.database.sqlite.SQLiteConnection.-$$Nest$smnativePrepareStatement(Unknown Source:0)
	at android.database.sqlite.SQLiteConnection$PreparedStatementCache.createStatement(SQLiteConnection.java:1562)
	at android.database.sqlite.SQLiteConnection.acquirePreparedStatementLI(SQLiteConnection.java:1098)
	at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1126)
	at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:686)
	at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:614)
	at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:62)
	at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
	at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
	at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1818)
	at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:601)
	at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:472)
	at fr.free.nrw.commons.category.CategoryContentProvider.query(CategoryContentProvider.java:61)
	at android.content.ContentProvider.query(ContentProvider.java:1620)
	at android.content.ContentProvider.query(ContentProvider.java:1716)
	at android.content.ContentProvider$Transport.query(ContentProvider.java:295)
	at android.content.ContentProviderClient.query(ContentProviderClient.java:196)
	at android.content.ContentProviderClient.query(ContentProviderClient.java:178)
	at android.content.ContentProviderClient.query(ContentProviderClient.java:168)
	at fr.free.nrw.commons.category.CategoryDao.recentCategories(CategoryDao.java:87)
	at fr.free.nrw.commons.category.CategoriesModel.suggestionsOrSearch(CategoriesModel.kt:96)
	at fr.free.nrw.commons.category.CategoriesModel.searchAll(CategoriesModel.kt:82)
	at fr.free.nrw.commons.repository.UploadRepository.searchAll(UploadRepository.java:124)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter.searchResults(CategoriesPresenter.kt:89)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter.access$searchResults(CategoriesPresenter.kt:27)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter$onAttachView$2.invoke(CategoriesPresenter.kt:61)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter$onAttachView$2.invoke(CategoriesPresenter.kt:61)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter.onAttachView$lambda$1(CategoriesPresenter.kt:61)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter.$r8$lambda$V9nJs5XN8YTx1bOUFgkxBKeDtrk(CategoriesPresenter.kt:0)
	at fr.free.nrw.commons.upload.categories.CategoriesPresenter$$ExternalSyntheticLambda10.apply(R8$$SyntheticClass:0)
	at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.onNext(ObservableSwitchMap.java:111)
	at io.reactivex.internal.operators.observable.ObservableDoOnEach$DoOnEachObserver.onNext(ObservableDoOnEach.java:101)
	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
	at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
	at android.os.Handler.handleCallback(Handler.java:959)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8592)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

I've attached the full log:
CommonsAppLogs.0.txt

@mnalis
Copy link
Contributor

mnalis commented Apr 13, 2024

Interesting . That ERROR:

[CategoriesPresenter$onAttachView] : android.database.sqlite.SQLiteException: 
no such column: description (code 1 SQLITE_ERROR): , while compiling: 
SELECT _id, name, description, thumbnail, last_used, times_used FROM categories ORDER BY last_used DESC

sounds like there are columns missing from internal SQL database. That should not happen normally (or the app wouldn't be working for anyone if such bug made it to the release). I'm not very familiar for code there, but I had to hazard a guess, I would guess that there was some previous version of Commons app installed before, and that upgrade to newer version didn't quite work, leaving the database out of sync with the app.

If that guess is correct, then uninstalling (which will remove local database) and installing Commons app again (which will recreate it) should fix the issue. (provided you don't have some kind of os-based backup-app-data-to-cloud-and-restore-it-automagically-on-reinstall shenanigans enabled; in which case this might work instead: Android OS settings / Apps / Commons / Storage / Clear data). Would you be willing to try that @adambuchbinder ?

(full log also shows a case of badinteger / missingtitle ERRORS, but according to #5244 those are benign and may be ignored)

@kanahia1
Copy link
Contributor

kanahia1 commented Apr 14, 2024

@nicolas-raoul, Should we add how to get logs in readme.md file so that non-technical people can easily get through this.

@adambuchbinder
Copy link
Author

You're right; clearing the app data fixed it. Thanks! (This actually persisted across a phone migration, which... thanks?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants