LavaSearch

July 23, 2025 ยท View on GitHub

LavaSearch is an advanced search module for Lavaplayer and Lavalink. It returns a better search result than the default search support of Lavaplayer/Lavalink.

You can use this module with Lavaplayer or as a plugin for Lavalink v4 beta 3 or higher. Other plugins can link into this module to provide additional search sources.

Table of Contents

Supported Sources

  • LavaSrc (YouTube, YouTubeMusic, Deezer, Spotify, AppleMusic)

Add your own

Lavaplayer Usage

Replace x.y.z with the latest version number

Snapshot builds are available in https://maven.topi.wtf/snapshots with the short commit hash as the version

Using in Gradle:

Gradle
repositories {
  maven {
    url "https://maven.topi.wtf/releases"
  }
}

dependencies {
  implementation "com.github.topi314.lavasearch:lavasearch:x.y.z"
}

Using in Maven:

Maven
<repositories>
  <repository>
    <url>https://maven.topi.wtf/releases</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.github.topi314.lavasearch</groupId>
    <artifactId>lavasearch</artifactId>
    <version>x.y.z</version>
  </dependency>
</dependencies>

Usage

Create new SearchManager

var searchManager = new SearchManager();

//register sources
searchManager.registerSearchManager(source);

Basic usage

var query = "ytmsearch:bla bla";
var types = List.of(
        AudioSearchResult.Type.TRACK,
        AudioSearchResult.Type.PLAYLIST,
        AudioSearchResult.Type.ALBUM,
        AudioSearchResult.Type.ARTIST,
        AudioSearchResult.Type.TEXT
);


AudioSearchResult searchResult = searchManager.loadSearch(query, types);

This plugin requires Lavalink v4 or greater

To install this plugin either download the latest release and place it into your plugins folder or add the following into your application.yml

Note For a full application.yml example see here

Replace x.y.z with the latest version number

lavalink:
  plugins:
    - dependency: "com.github.topi314.lavasearch:lavasearch-plugin:x.y.z"
      repository: "https://maven.lavalink.dev/releases" # this is optional for lavalink v4.0.0-beta.5 or greater
      snapshot: false # set to true if you want to use snapshot builds (see below)

Snapshot builds are available in https://maven.lavalink.dev/snapshots with the short commit hash as the version

API

LavaSearch adds a new endpoint to Lavalink, GET /v4/loadsearch. This endpoint is used to search for tracks, albums, artists, playlists & text.

The endpoint accepts the following query parameters:

ParameterTypeDescription
querystringThe search query
typesstringThe types to search for, can be one or more of track, album, artist, playlist or text

The endpoint returns a search result JSON object

Search Result Object

Note

The tracks field of playlists are always empty

FieldTypeDescription
tracksarray of Track objectsAn array of tracks, only present if track is in types
albumsarray of Playlist objectsAn array of albums, only present if album is in types
artistsarray of Playlist objectsAn array of artists, only present if artist is in types
playlistsarray of Playlist objectsAn array of playlists, only present if playlist is in types
textsarray of Text objectsAn array of text results, only present if text is in types
pluginobjectAddition result data provided by plugins
Example Payload
{
  "tracks": [
    {
      "encoded": "QAAB/gMAB0FuaW1hbHMACkFyY2hpdGVjdHMAAAAAAAO5IAAKMTA5MDUzODA4MgABACNodHRwczovL2RlZXplci5jb20vdHJhY2svMTA5MDUzODA4MgEAAAAAAAAAAAA==",
      "info": {
        "identifier": "1090538082",
        "isSeekable": true,
        "author": "Architects",
        "length": 244000,
        "isStream": false,
        "position": 0,
        "title": "Animals",
        "uri": "https://deezer.com/track/1090538082",
        "sourceName": "deezer",
        "artworkUrl": "https://e-cdns-images.dzcdn.net/images/cover/f63fc26eda9ed39f84c1a533e2716f46/1000x1000-000000-80-0-0.jpg",
        "isrc": null
      },
      "pluginInfo": {}
    }
  ],
  "albums": [
    {
      "info": {
        "name": "For Those That Wish To Exist",
        "selectedTrack": -1
      },
      "pluginInfo": {},
      "tracks": []
    }
  ],
  "artists": [
    {
      "info": {
        "name": "Architects's Top Tracks",
        "selectedTrack": -1
      },
      "pluginInfo": {},
      "tracks": []
    }
  ],
  "playlists": [
    {
      "info": {
        "name": "100% Architects",
        "selectedTrack": -1
      },
      "pluginInfo": {},
      "tracks": []
    }
  ],
  "texts": [
    {
      "text": "Architects",
      "plugin": {}
    }
  ],
  "plugin": {}
}

If no results are found the endpoint returns a http status code of 204 No Content

Text Object

FieldTypeDescription
textstringThe title of the text result
pluginobjectAddition result data provided by plugins