//Main search method, does preprocessing of special and recommendation queries //in the case of special and regular queries, they're sent to the Lucene Service for search and retrieval //in the case of recommendation queries, they're sent to the method that handles the Last.FM API private void Search(string query) { IEnumerable <Result> songs, artists, albums, genres; bool recommendationQuery = false; songs = artists = albums = genres = null; query = query.Trim(); //empty query will show all documents //todo: check if we should show songs since they're so many if (query == "") { query = "*:*"; } //special query if (query.Contains("!songs")) { query = processSpecialQuery(query); } //only works for artists else if (query.Contains("!similarto")) { artists = processRecommendationQuery(query); recommendationQuery = true; } if (!recommendationQuery) { lucene.Search(query, ref songs, ref artists, ref albums, ref genres); } DisplayResults(songs, artists, albums, genres); }