Ejemplo n.º 1
0
        static object Index(IndexOptions options)
        {
            RecipeDocument recipe;

            try
            {
                recipe = RecipeFactory.CreateFrom(options.Url);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(1);
            }

            RecipeClient client = SearchClientFactory.CreateClient(options);

            var response = client.Index(recipe);

            Console.WriteLine($"Index: {FormatApiCall(response.ApiCall)}");

            return(0);
        }
Ejemplo n.º 2
0
        static object Index(IndexOptions options)
        {
            var recipe = RecipeFactory.CreateFrom(options.Url);
            var client = SearchClientFactory.CreateClient(options);

            var response = client.Index(recipe);

            Console.WriteLine(response.DebugInformation);

            //var result = client.Search(search => search.QueryOnQueryString(options.Query)
            //                                           .Sort(order => order.Descending(field => field.Rating))
            //                                           .Take(20));

            //Fråga mot specifikt fält
            //var result = client.Count(search => search.Query(
            //                                      query => query.Match(
            //                                          match => match.Field(field => field.Author)
            //                                                        .Query("Per Morberg"))));

            var result = client.Search(search => search.QueryOnQueryString("categories:\"Bönor\""));

            return(0);
        }