Esempio n. 1
0
        public void SongNameSpecialChar()
        {
            //由于曲目中含有特殊的字符,所以会导致搜索缓存时出现错误
            XiamiDownload down = new XiamiDownload();
            //Re:GENERATION (Extended Mix) 田口康裕
            var search = "Re%3aGENERATION+(Extended+Mix)+%e7%94%b0%e5%8f%a3%e5%ba%b7%e8%a3%95";
            var result = GetSearch()(down, search);

            Assert.AreNotEqual(null, result);
        }
Esempio n. 2
0
        public void AllTest()
        {
            XiamiDownload down = new XiamiDownload();

            var result = GetSearch()(down, "positive+dance+%22Final+RAVE%22+Cranky");

            Assert.AreNotEqual(null, result);
            var result2 = GetSearch()(down, "ILIAS");

            Assert.AreNotEqual(null, result2);
        }
Esempio n. 3
0
        public async void GetSearch_From_GetSearchClass()
        {
            //Arrange
            string    starwarsQuery    = "Luke";
            string    chuckNorrisQuery = "Moon";
            GetSearch getSearch        = new GetSearch();

            //Act
            var StarWarsRes = await getSearch.ReturnSearch(starwarsQuery);

            var ChuckNorrisRes = await getSearch.ReturnSearch(chuckNorrisQuery);

            //Assert
            Assert.NotNull(StarWarsRes.Item1);
            Assert.NotNull(ChuckNorrisRes.Item2);
        }
Esempio n. 4
0
        public static async Task SearchIndex(HttpContext httpContext, GetSearch getSearch)
        {
            string searchString = getSearch.Data.ToLower();

            ISearchResponse <ElasticTitle> response = await HtcPlugin.ElasticClient.SearchAsync <ElasticTitle>(s => s
                                                                                                               .Index("title")
                                                                                                               .From(0)
                                                                                                               .Size(5)
                                                                                                               .Query(q => q
                                                                                                                      .MatchPhrasePrefix(pp => pp
                                                                                                                                         .Name("title_query")
                                                                                                                                         .Boost(1.1)
                                                                                                                                         .Field(f => f.Name)
                                                                                                                                         .Query(searchString)
                                                                                                                                         )
                                                                                                                      )
                                                                                                               );

            await httpContext.Response.WriteAsync(JsonSerializer.Serialize(new { success = true, search = searchString, result = response.Documents }));
        }