private async Task <List <Product> > SlowExsperimentalSearch(string searchterm) { string[] InduviduelTerms = searchterm.Split(" "); ProductHandling pTest = new ProductHandling(); List <List <Product> > TempListList = new List <List <Product> >(); List <Product> ProductList = new List <Product>(); foreach (string s in InduviduelTerms) { TempListList.Add(await pTest.ReferencesAsync(s)); } TempListList = TempListList.OrderByDescending(x => - x.Count).ToList(); if (ProductList.Count == 0) { foreach (List <Product> Plist in TempListList) { if (Plist.Count != 0) { ProductList = Plist; break; } } } foreach (Product p in ProductList) { p._CustomReferenceField += ",*"; } return(ProductList); }
public async Task GenerateData(bool coop, bool webcrawler, bool generatePrice, bool DeleteRefrences, bool autocomplete) { ProductHandling productHandling = new ProductHandling(); if (coop) { CoopDoStuff tryCoop = new CoopDoStuff("d0b9a5266a2749cda99d4468319b6d9f"); List <CoopProduct> coopProducts = tryCoop.CoopFindEverythingInStore("24073"); int count = 0; foreach (CoopProduct c in coopProducts) { count++; Console.WriteLine(count); await dc.Product.Add(new Product("F" + c.Ean, c.Navn, c.Navn2, c.Pris, "", "Fakta")); } } if (webcrawler) { RecipeCrawl WebRunner = new RecipeCrawl(); _ = WebRunner.GetRecipes(100, 2884, dc); Console.WriteLine("web runner begins... fear its power"); Console.ReadKey(); } if (generatePrice) { await dc.Recipe.GenerateCheapestPL(); await dc.Recipe.PopulateIngredientLink(); } if (DeleteRefrences) { List <Product> products = dc.Product.GetList(""); foreach (Product product in products) { _ = dc.Product.AddReference("", product._id); } } if (autocomplete) { await dc.Product.AddAutocompleteToDB(); } }