Better Searching #7

Open
opened 2023-03-23 02:53:53 +00:00 by erin · 1 comment

Right now the search is implemented using MPD's native search() function. This works [citation needed], but has some limitations.

  1. It requires querying the backend every time a search is made. On every keystroke, or for large databases, this can be slow.
  2. It has limited functionality, only allowing for a single search term, and no fuzzy search.
  3. The API is primarily built for searching songs, so is difficult to use for searching for other things.

My idea is to query MPD once at startup, and maybe every couple of minutes or something, then store all the info - either in-memory (hashbrown,phf,BTreeMap), or in a sled database.
I can then implement custom search functions (using libraries such as indicium) for this, that have custom API's built for my use cases. It will also be much faster, and put less load on the server.
I'll also try and implement serde (de)-serialization.

Right now the search is implemented using MPD's native [search()](https://docs.rs/mpd/latest/mpd/client/struct.Client.html#method.search) function. This works *[citation needed]*, but has some limitations. 1. It requires querying the backend every time a search is made. On every keystroke, or for large databases, this can be slow. 2. It has limited functionality, only allowing for a single search term, and no fuzzy search. 3. The API is primarily built for searching songs, so is difficult to use for searching for other things. My idea is to query MPD once at startup, and maybe every couple of minutes or something, then store all the info - either in-memory *([hashbrown](https://lib.rs/crates/hashbrown),[phf](https://lib.rs/crates/phf),BTreeMap)*, or in a [sled](https://sled.rd) database. I can then implement custom search functions *(using libraries such as [indicium](https://lib.rs/crates/indicium))* for this, that have custom API's built for my use cases. It will also be much faster, and put less load on the server. I'll also try and implement [serde]() (de)-serialization.
erin added the
feature
label 2023-03-23 02:53:53 +00:00
erin added this to the Features project 2023-03-23 02:53:53 +00:00
erin added a new dependency 2023-03-23 02:54:18 +00:00
erin added the
bug
label 2023-03-23 02:54:46 +00:00
erin added a new dependency 2023-03-23 02:55:29 +00:00
erin added this to the v0.3.0 milestone 2023-03-23 03:02:45 +00:00
Poster
Owner
  1. Create serializable structs for data to store
  2. Implement basic storage of example data
  3. Fetch data from MPD and store it
  4. Retrieve data and list
1. [x] Create serializable structs for data to store 2. [ ] Implement basic storage of example data 3. [ ] Fetch data from MPD and store it 4. [ ] Retrieve data and list
erin modified the milestone from v0.3.0 to v0.2.0 2023-03-29 16:46:21 +00:00
erin added a new dependency 2023-03-29 16:46:35 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: erin/xenmotif#7
There is no content yet.