spotube icon indicating copy to clipboard operation
spotube copied to clipboard

Filtering / searching for a song inside a playlist does not give the correct results

Open Robin-Sch opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When searching for a specific song by the complete title, for example called "little girl gone" (by chinchilla), it does not show up in the search/filter. The app does however show completely irrelevant songs like "you can't stop the girl" (by bebe rexha) and "on & on" (by Cartoon, Daniel Levi) which contain only parts of the search query/string. In this case the song isn't even shown. But in some other cases the song I searched for is further down in the list. Imo it should then by on top as the search query is the same as the title.

Expected Behavior

It should list the song on top

Steps to reproduce

  1. Add "Little Girl Gone" (by chinchilla) to your playlist
  2. Open the app and go to the playlist
  3. Search for "little girl gone"

Operating System

Android 13

Spotube version

v3.4.0

Installation source

Play Store (Android)

Additional information

No response

Robin-Sch avatar Jan 06 '24 13:01 Robin-Sch

Hi,

there's no direct support for loading extensions in the library. You'll need to compile sqlite-vss in your project and then initialize the extension(s) when your app starts, for example from main.m

#include "sqlite3.h"
#include "sqlite-vector.h"
#include "sqlite-vss.h"

int main(int argc, char **argv) {
    sqlite3_auto_extension((void (*)(void)) sqlite3_vector_init);
    sqlite3_auto_extension((void (*)(void)) sqlite3_vss_init);

    // start actual iOS app
    UIApplicationMain(argc, argv, nil, NSStringFromClass(AppDelegate.class));
}

I haven't tested this, but this in general how you load SQLite extensions.

See the sample code here: https://github.com/asg017/sqlite-vss/blob/c3bacfd61ed122a581942108ee1e457767f28876/examples/c/demo.c#L28

jberkel avatar May 27 '23 19:05 jberkel

How can that solution be adapted to a Swift project? Looks like main.m doesn't exist in that context 🤷‍♂️

tantaman avatar Jul 21 '23 20:07 tantaman

You can create a main.m in even for a Swift project. Perhaps an easier solution could be to use the @main annotation in Swift, but I haven't tried this.

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/attributes/#main

jberkel avatar Jul 21 '23 22:07 jberkel

Ty. Actually eventually figured it out (I'm an extension author not iOS dev 😅) --

https://github.com/tantaman/xcode-starter/blob/a755ad175caf091b3e61d4aa0fe69e996082ecf4/xcode-starter/xcode_starterApp.swift#L10-L14

The new wrinkle is this:

SQLITE_DEPRECATED_NO_REPLACEMENT("Process-global auto extensions are not supported on Apple platforms", macos(10.10, 10.10), ios(8.2, 8.2), watchos(2.0, 2.0), tvos(9.0, 9.0))
SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));

so sqlite3_auto_extension always returns an error.

We've worked around that problem by using the sqlite3 package from cocoapods

tantaman avatar Jul 21 '23 22:07 tantaman