Implemented the new search engine

This commit is contained in:
CappielloAntonio 2021-07-31 14:47:29 +02:00
parent 05d2e0b9ec
commit 320e3b8678
9 changed files with 212 additions and 238 deletions

View file

@ -32,14 +32,14 @@ public class SearchingClient {
this.searchingService = retrofit.create(SearchingService.class);
}
public Call<SubsonicResponse> search2(String query) {
public Call<SubsonicResponse> search2(String query, int songCount, int albumCount, int artistCount) {
Log.d(TAG, "search2()");
return searchingService.search2(subsonic.getParams(), query);
return searchingService.search2(subsonic.getParams(), query, songCount, albumCount, artistCount);
}
public Call<SubsonicResponse> search3(String query) {
public Call<SubsonicResponse> search3(String query, int songCount, int albumCount, int artistCount) {
Log.d(TAG, "search3()");
return searchingService.search3(subsonic.getParams(), query);
return searchingService.search3(subsonic.getParams(), query, songCount, albumCount, artistCount);
}
private TikXml getParser() {

View file

@ -6,12 +6,13 @@ import java.util.Map;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
public interface SearchingService {
@GET("search2?query={query}")
Call<SubsonicResponse> search2(@QueryMap Map<String, String> params, String query);
@GET("search2")
Call<SubsonicResponse> search2(@QueryMap Map<String, String> params, @Query("query") String query, @Query("songCount") int songCount, @Query("albumCount") int albumCount, @Query("artistCount") int artistCount);
@GET("search3?query={query}")
Call<SubsonicResponse> search3(@QueryMap Map<String, String> params, String query);
@GET("search3")
Call<SubsonicResponse> search3(@QueryMap Map<String, String> params, @Query("query") String query, @Query("songCount") int songCount, @Query("albumCount") int albumCount, @Query("artistCount") int artistCount);
}

View file

@ -1,91 +1,50 @@
package com.cappielloantonio.play.subsonic.models;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
@Xml
public class SearchResult2 {
@Element(name = "artist")
protected List<Artist> artists;
@Element(name = "album")
protected List<Child> albums;
@Element(name = "song")
protected List<Child> songs;
/**
* Gets the value of the artists property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the artists property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getArtists().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Artist }
*/
public List<Artist> getArtists() {
if (artists == null) {
artists = new ArrayList<Artist>();
artists = new ArrayList<>();
}
return this.artists;
}
/**
* Gets the value of the albums property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the albums property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAlbums().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getAlbums() {
if (albums == null) {
albums = new ArrayList<Child>();
albums = new ArrayList<>();
}
return this.albums;
}
/**
* Gets the value of the songs property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the songs property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSongs().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getSongs() {
if (songs == null) {
songs = new ArrayList<Child>();
songs = new ArrayList<>();
}
return this.songs;
}
public void setArtists(List<Artist> artists) {
this.artists = artists;
}
public void setAlbums(List<Child> albums) {
this.albums = albums;
}
public void setSongs(List<Child> songs) {
this.songs = songs;
}
}

View file

@ -1,91 +1,50 @@
package com.cappielloantonio.play.subsonic.models;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
@Xml
public class SearchResult3 {
@Element(name = "artist")
protected List<ArtistID3> artists;
@Element(name = "album")
protected List<AlbumID3> albums;
@Element(name = "song")
protected List<Child> songs;
/**
* Gets the value of the artists property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the artists property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getArtists().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ArtistID3 }
*/
public List<ArtistID3> getArtists() {
if (artists == null) {
artists = new ArrayList<ArtistID3>();
artists = new ArrayList<>();
}
return this.artists;
}
/**
* Gets the value of the albums property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the albums property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAlbums().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AlbumID3 }
*/
public List<AlbumID3> getAlbums() {
if (albums == null) {
albums = new ArrayList<AlbumID3>();
albums = new ArrayList<>();
}
return this.albums;
}
/**
* Gets the value of the songs property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the songs property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSongs().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getSongs() {
if (songs == null) {
songs = new ArrayList<Child>();
songs = new ArrayList<>();
}
return this.songs;
}
public void setArtists(List<ArtistID3> artists) {
this.artists = artists;
}
public void setAlbums(List<AlbumID3> albums) {
this.albums = albums;
}
public void setSongs(List<Child> songs) {
this.songs = songs;
}
}

View file

@ -44,7 +44,9 @@ public class SubsonicResponse {
private PlaylistWithSongs playlist;
@Element
private Playlists playlists;
@Element
private SearchResult3 searchResult3;
@Element
private SearchResult2 searchResult2;
private SearchResult searchResult;
private NowPlaying nowPlaying;