public Schema() : base() { InstanceType = typeof(__LaLazyLoad__); ClassName = "LazyLoadingPagePeople"; Properties.ClearExposed(); Order = Add <__TLong__>("Order"); Order.DefaultValue = 0L; Order.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__Order__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__Order__ = (System.Int64)_v_; }, false); FirstName = Add <__TString__>("FirstName"); FirstName.DefaultValue = ""; FirstName.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__FirstName__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__FirstName__ = (System.String)_v_; }, false); LastName = Add <__TString__>("LastName"); LastName.DefaultValue = ""; LastName.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__LastName__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__LastName__ = (System.String)_v_; }, false); FavoriteGame = Add <__TString__>("FavoriteGame"); FavoriteGame.DefaultValue = ""; FavoriteGame.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__FavoriteGame__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__FavoriteGame__ = (System.String)_v_; }, false); IsHovered = Add <__TLong__>("IsHovered$"); IsHovered.DefaultValue = 0L; IsHovered.Editable = true; IsHovered.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__IsHovered__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__IsHovered__ = (System.Int64)_v_; }, false); IsHovered.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.IsHovered() { App = (LazyLoadingPagePeople)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((LazyLoadingPagePeople)pup).Handle((Input.IsHovered)input); }); DataIsLoaded = Add <__TBool__>("DataIsLoaded"); DataIsLoaded.DefaultValue = false; DataIsLoaded.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__DataIsLoaded__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__DataIsLoaded__ = (System.Boolean)_v_; }, false); DataToShow = Add <__TString__>("DataToShow"); DataToShow.DefaultValue = ""; DataToShow.SetCustomAccessors((_p_) => { return(((__LaLazyLoad__)_p_).__bf__DataToShow__); }, (_p_, _v_) => { ((__LaLazyLoad__)_p_).__bf__DataToShow__ = (System.String)_v_; }, false); }
public IActionResult Run(RunParams runParams) { string searchTerm = runParams.SearchTerm ?? "smile"; string preTag = runParams.PreTag ?? " (: "; string postTag = runParams.PostTag ?? " :) "; int fragmentLength = runParams.FragmentLength ?? 80; int fragmentCount = runParams.FragmentCount ?? 1; Highlightings highlightingsInfo; #region Demo List <ArtistsAllSongs.IndexEntry> artistsResults; using (IDocumentSession session = DocumentStoreHolder.MediaStore.OpenSession()) { #region Step_6 HighlightingOptions highlightOptions = new HighlightingOptions { GroupKey = "Artist", PreTags = new[] { preTag }, PostTags = new[] { postTag } }; #endregion #region Step_7 artistsResults = session.Query <ArtistsAllSongs.IndexEntry, ArtistsAllSongs>() .Highlight(x => x.AllSongTitles, fragmentLength, fragmentCount, highlightOptions, out highlightingsInfo) .Search(x => x.AllSongTitles, searchTerm) .ToList(); #endregion #region Step_8 if (artistsResults.Count > 0) { string[] songsFragments = highlightingsInfo.GetFragments(artistsResults[0].Artist); } #endregion } #endregion List <DataToShow> highlightResults = new List <DataToShow>(); foreach (var artistItem in artistsResults) { string[] songsFragments = highlightingsInfo.GetFragments(artistItem.Artist); foreach (var fragment in songsFragments) { DataToShow itemResults = new DataToShow { Artist = artistItem.Artist, SongFragment = fragment }; highlightResults.Add(itemResults); } } return(Ok(highlightResults.OrderBy(x => x.Artist))); }
public IActionResult Run(RunParams runParams) { int fragmentLength = runParams.FragmentLength ?? 50; int fragmentCount = runParams.FragmentCount ?? 2; Highlightings notesHighlightings; #region Demo List <Employee> employeesResults; using (IDocumentSession session = DocumentStoreHolder.Store.OpenSession()) { #region Step_5 employeesResults = session.Query <EmployeesDetails.IndexEntry, EmployeesDetails>() .Highlight("Notes", fragmentLength, fragmentCount, out notesHighlightings) .Search(x => x.Notes, "sales") .OfType <Employee>() .ToList(); #endregion #region Step_6 if (employeesResults.Count > 0) { string employeeId = employeesResults[0].Id; string[] notesFragments = notesHighlightings.GetFragments(employeeId); } #endregion } #endregion List <DataToShow> highlightResults = new List <DataToShow>(); foreach (var employee in employeesResults) { string[] notesFragments = notesHighlightings.GetFragments(employee.Id); foreach (var item in notesFragments) { DataToShow itemResults = new DataToShow { documentId = employee.Id, indexField = notesHighlightings.FieldName, fragment = item }; highlightResults.Add(itemResults); } } return(Ok(highlightResults.OrderByDescending(x => x.indexField))); }
public async Task LoadVideo() { DataToShow.Clear(); try { var videoModel = await VideoProcessor.LoadVideo(); Pagination = videoModel.Data.Pagination; foreach (var video in videoModel.Data.Videos) { var thumbnailLink = $"https:{video.PreviewImages[0]}"; var uriSource = new Uri(thumbnailLink, UriKind.Absolute); var data = new Display(new BitmapImage(uriSource), video.Title, video.Duration, video.Quality.ToUpper(), video.Uploader, video.Tags); data.Tags.Sort(); DataToShow.Add(data); } } catch (Exception e) { Console.WriteLine(e.Message); var uriSource = new Uri("https://www.iconfinder.com/data/icons/image-1/64/Image-12-512.png", UriKind.Absolute); var substitute = new Display(new BitmapImage(uriSource), "No videos found, please check, if you're connected to the internet and provided the correct PSID and access key in Assets\\API.txt!", 0, "", "", null); Pagination = new Pagination() { CurrentPage = 1, TotalPages = 0 }; DataToShow.Add(substitute); } }
public IActionResult Run(RunParams runParams) { int fragmentLength = runParams.FragmentLength ?? 100; int fragmentCount = runParams.FragmentCount ?? 1; string tag1 = runParams.Tag1 ?? "+++"; string tag2 = runParams.Tag2 ?? "+++"; string tag3 = runParams.Tag3 ?? "<<<"; string tag4 = runParams.Tag4 ?? ">>>"; Highlightings titleHighlightings; Highlightings notesHighlightings; #region Demo List <Employee> employeesResults; using (IDocumentSession session = DocumentStoreHolder.Store.OpenSession()) { #region Step_5 HighlightingOptions tagsToUse1 = new HighlightingOptions { PreTags = new[] { tag1 }, PostTags = new[] { tag2 } }; HighlightingOptions tagsToUse2 = new HighlightingOptions { PreTags = new[] { tag3 }, PostTags = new[] { tag4 } }; #endregion #region Step_6 employeesResults = session.Query <EmployeesDetails.IndexEntry, EmployeesDetails>() .Highlight("Title", fragmentLength, fragmentCount, tagsToUse1, out titleHighlightings) .Highlight("Notes", fragmentLength, fragmentCount, tagsToUse2, out notesHighlightings) .Search(x => x.Title, "manager") .Search(x => x.Notes, "sales") .OfType <Employee>() .ToList(); #endregion #region Step_7 if (employeesResults.Count > 0) { string employeeId = employeesResults[0].Id; string[] titleFragments = titleHighlightings.GetFragments(employeeId); string[] notesFragments = notesHighlightings.GetFragments(employeeId); } #endregion } #endregion List <DataToShow> highlightResults = new List <DataToShow>(); foreach (var employee in employeesResults) { string[] titleFragments = titleHighlightings.GetFragments(employee.Id); foreach (var item in titleFragments) { DataToShow itemResults = new DataToShow { documentId = employee.Id, indexField = titleHighlightings.FieldName, fragment = item }; highlightResults.Add(itemResults); } string[] notesFragments = notesHighlightings.GetFragments(employee.Id); foreach (var item in notesFragments) { DataToShow itemResults = new DataToShow { documentId = employee.Id, indexField = notesHighlightings.FieldName, fragment = item }; highlightResults.Add(itemResults); } } return(Ok(highlightResults.OrderByDescending(x => x.indexField))); }