Ejemplo n.º 1
0
        /// <summary>
        /// Method to get search model
        /// </summary>
        /// <returns>ISearchPage<ListingSearchResultItem> </returns>
        public ISearchPage GetSearchPageModel()
        {
            IMvcContext mvcContext      = _mvcContext();
            ISearchPage searchPageModel = mvcContext.GetContextItem <ISearchPage>();

            return(searchPageModel ?? _searchPageModel);
        }
Ejemplo n.º 2
0
            public SearchPageApplication(ISearchPage page, Application master)
            {
                new ContentContainer
                {
                    Content = new { Native.document.location.search }.ToString()
                }.AttachToDocument();


                new IHTMLDiv
                {
                    innerHTML = @"
                    <style>
                    html {
                        transition: border-top 500ms linear;
                        border-top: 4em solid purple;
                    }

                    </style>"
                }.With(
                    async div =>
                {
                    //await Native.window.requestAnimationFrameAsync;

                    // wont work for html?
                    await Task.Delay(100);

                    div.AttachToDocument();
                }
                    );
            }
Ejemplo n.º 3
0
        public void Setup()
        {
            System.Console.Write("Scenarios Setup.\r\n");

            var appSettings = ConfigurationManager.AppSettings;

            string[] browsers = appSettings["Browsers"].Split(';');

            var pages = new ConcurrentStack <ISearchPage>();

            foreach (string browser in browsers)
            {
                if (browser == "Chrome")
                {
                    Parallel.Invoke(() => pages.Push(new SearchPage <ChromeGrid>()));
                }
                if (browser == "Firefox")
                {
                    Parallel.Invoke(() => pages.Push(new SearchPage <FireFoxGrid>()));
                }
                if (browser == "IE")
                {
                    Parallel.Invoke(() => pages.Push(new SearchPage <InternetExplorerGrid>()));
                }
            }
            var parallelPage = new ParallelModel <ISearchPage>(pages.ToArray());

            _page = parallelPage.Cast();
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static List <SortOrder> ReturnCurrentSort(this ISearchPage srchPage, string currentSort)
        {
            var sorts = new List <SortOrder>();

            if (!string.IsNullOrEmpty(currentSort))
            {
                // TO DO 01: not loading correct sort order
                sorts.Add(new SortOrder(currentSort, SortOrder.SortOption.Descending));

                return(sorts);
            }

            if (srchPage.Sort == null)
            {
                return(sorts);
            }

            //var sortSettings = srchPage.Sort.FilteredContents.OfType<SortBlock>();
            var sortSettings = EpiHelper.GetContentAreaContent <SortBlock>(srchPage.Sort.Items);


            foreach (var s in sortSettings)
            {
                sorts.Add(new SortOrder(s.FieldName, s.SortOrder));
            }

            return(sorts);
        }
Ejemplo n.º 5
0
            public SearchPageApplication(ISearchPage page, Application master)
            {
                new ContentContainer
                {
                    Content = new { Native.document.location.search }.ToString()
                }.AttachToDocument();


                new IHTMLDiv
                {
                    innerHTML = @"
                    <style>
                    html {
                        transition: border-top 500ms linear;
                        border-top: 4em solid purple;
                    }

                    </style>"
                }.With(
                    async div =>
                    {
                        //await Native.window.requestAnimationFrameAsync;

                        // wont work for html?
                        await Task.Delay(100);

                        div.AttachToDocument();
                    }
                    );

            }
Ejemplo n.º 6
0
        public void AssertTextOnPage()
        {
            _searchPage = UnityWrapper.Resolve <ISearchPage>();
            var titel     = _searchPage.GetPageTitel();
            var pageTitel = "Nuneaton Properties for Sale | Purplebricks";

            Assert.AreEqual(titel, pageTitel);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static List <IFacet> ReturnFacetSettings(this ISearchPage srchPage)
        {
            var facets = new List <IFacet>();

            if (srchPage.Facets == null)
            {
                return(facets);
            }

            var facetBlocks = EpiHelper.GetContentAreaContent <BlockData>(srchPage.Facets.Items);

            foreach (var facetBlock in facetBlocks)
            {
                if (facetBlock is FieldFacetBlock)
                {
                    var fieldFacet = facetBlock as FieldFacetBlock;

                    facets.Add(new FieldFacet(fieldFacet.FieldName, fieldFacet.Label)
                    {
                        Sort             = fieldFacet.SortOption,
                        Order            = facetBlocks.IndexOf(facetBlock),
                        RefinementOption = fieldFacet.RefinementType,
                    });
                }
                else if (facetBlock is CategoryFacetBlock)
                {
                    var categoryFacet = facetBlock as CategoryFacetBlock;

                    var list = categoryFacet.CategoryName;

                    if (list.Any())
                    {
                        var categoryName = EpiHelper.GetCategoryName(list.First());

                        facets.Add(new CategoryFacet("categories", categoryName, categoryFacet.Label)
                        {
                            Sort             = categoryFacet.SortOption,
                            Order            = facetBlocks.IndexOf(facetBlock),
                            RefinementOption = categoryFacet.RefinementType,
                        });
                    }
                }
                else if (facetBlock is DateRangeFacetBlock)
                {
                    var dateFacetBlock = facetBlock as DateRangeFacetBlock;
                    var dateFacet      = ProcessDateFacetBlock(dateFacetBlock, facetBlocks.IndexOf(facetBlock));
                    facets.Add(dateFacet);
                }
                else if (facetBlock is RangeFacetBlock)
                {
                    var rangeFacetBlock = facetBlock as RangeFacetBlock;
                    var rangeFacet      = ProcessRangeFacetBlock(rangeFacetBlock, facetBlocks.IndexOf(facetBlock));
                    facets.Add(rangeFacet);
                }
            }

            return(facets);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="srchPage"></param>
        /// <returns></returns>
        public static int GetPageSize(this ISearchPage srchPage)
        {
            if (srchPage.PageSize <= 0)
            {
                return(10);
            }

            return(srchPage.PageSize);
        }
 public TestsForECommerce(IRegistrationAndLogin registrationAndLogin,
                          IBasePageAndNavigation basePageAndNavigation,
                          ICartPage cartPage,
                          ISearchPage searchPage)
 {
     _registrationAndLogin  = registrationAndLogin;
     _basePageAndNavigation = basePageAndNavigation;
     _cartPage   = cartPage;
     _searchPage = searchPage;
 }
Ejemplo n.º 10
0
        public HomePage()
        {
            var pages = new ConcurrentStack <ISearchPage>();

            Parallel.Invoke(
                //  () => pages.Push(new SearchPage<InternetExplorerGrid>()),
                () => pages.Push(new SearchPage <ChromeGrid>()),
                () => pages.Push(new SearchPage <FireFoxGrid>())
                );
            var parallelPage = new ParallelModel <ISearchPage>(pages.ToArray());

            _page = parallelPage.Cast();
        }
Ejemplo n.º 11
0
 public ListingRepository(Func <IMvcContext> mvcContext, ISearchManager searchManager, IImage_Gallery_Page imageGallery, IImage_Album imageAlbum,
                          IVideo_Gallery_Page videoGallery, IVideo_Album_Without_Filters videoAlbum, INews_Listing_Page newsModel, IEvents_Listing_Page eventsModel,
                          IDownloads_Page downloadsModel, ISearchPage searchPageModel)
 {
     _mvcContext      = mvcContext;
     _searchManager   = searchManager;
     _imageGallery    = imageGallery;
     _imageAlbum      = imageAlbum;
     _videoGallery    = videoGallery;
     _videoAlbum      = videoAlbum;
     _newsModel       = newsModel;
     _eventsModel     = eventsModel;
     _downloadsModel  = downloadsModel;
     _searchPageModel = searchPageModel;
 }
Ejemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="srchPage"></param>
        /// <returns></returns>
        ///

        public static List <SortOrder> GetSortSettings(this ISearchPage srchPage)
        {
            var sorts = new List <SortOrder>();

            if (srchPage.Sort == null)
            {
                return(sorts);
            }

            //var sortSettings = srchPage.Sort.Items.OfType<SortBlock>();
            var sortSettings = EpiHelper.GetContentAreaContent <SortBlock>(srchPage.Sort.Items);

            foreach (var s in sortSettings)
            {
                sorts.Add(new SortOrder(s.FieldName, s.SortOrder));
            }

            return(sorts);
        }
Ejemplo n.º 13
0
        void AddSearchToToolbar(ISearchPage page, string pageTitle)
        {
            if (GetToolbar() is Toolbar toolBar && toolBar.Menu?.FindItem(Resource.Id.ActionSearch)?.ActionView?.JavaCast <SearchView>().GetType() != typeof(SearchView))
            {
                toolBar.Title = pageTitle;
                toolBar.InflateMenu(Resource.Menu.MainMenu);

                if (toolBar.Menu?.FindItem(Resource.Id.ActionSearch)?.ActionView?.JavaCast <SearchView>() is SearchView searchView)
                {
                    var adapter = new Android.Widget.ArrayAdapter <String>(Context, Resource.Layout.list_item, page.Suggestions);

                    searchView.SubmitButtonEnabled = true;
                    searchView.SetIconifiedByDefault(false);

                    searchView.QueryTextSubmit += HandleQueryTextSubmit;
                    searchView.SuggestionClick += HandleSuggestionClick;

                    searchView.QueryHint  = page.PlaceHolder;
                    searchView.ImeOptions = (int)ImeAction.Search;
                    searchView.InputType  = (int)InputTypes.TextVariationFilter;
                    searchView.MaxWidth   = int.MaxValue; //Set to full width - http://stackoverflow.com/questions/31456102/searchview-doesnt-expand-full-width

                    // https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/SearchView.java
                    //var mSearchEditFrame = searchView.FindViewById(Resource.Id.search_edit_frame);
                    //var mSearchPlate = searchView.FindViewById(Resource.Id.search_plate);
                    //var mSubmitArea = searchView.FindViewById(Resource.Id.submit_area);
                    //var mSearchButton = (Android.Widget.ImageView)searchView.FindViewById(Resource.Id.search_button);
                    //var mGoButton = (Android.Widget.ImageView)searchView.FindViewById(Resource.Id.search_go_btn);
                    //var mCloseButton = (Android.Widget.ImageView)searchView.FindViewById (Resource.Id.search_close_btn);
                    //var mCollapsedIcon = (Android.Widget.ImageView)searchView.FindViewById(Resource.Id.search_mag_icon);

                    var mAutoCompleteText = (AppCompatAutoCompleteTextView)searchView.FindViewById(Resource.Id.search_src_text);
                    mAutoCompleteText.Adapter   = adapter;
                    mAutoCompleteText.Threshold = 1; //will start working from first character
                }
            }
        }
Ejemplo n.º 14
0
 public Android_StackOverflowSteps(ISearchPage searchPage)
 {
     this.searchPage = searchPage;
 }
Ejemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="srchPage"></param>
        /// <param name="queryText"></param>
        /// <returns></returns>
        public static List <T> ReturnSuggestedResults <T>(this ISearchPage srchPage, string queryText) where T : ISearchDocument
        {
            var suggResults = new List <T>();

            if (srchPage.SuggestedResults == null)
            {
                return(suggResults);
            }

            var suggestedResultBlocks = EpiHelper.GetContentAreaContent <SuggestedResultsBlock>(srchPage.SuggestedResults.Items);

            var guidList = new List <string>();

            var queryIntercept = queryText.ToLower();

            foreach (var suggestedBlock in suggestedResultBlocks)
            {
                if (string.IsNullOrEmpty(suggestedBlock.Terms))
                {
                    continue;
                }

                var suggestedTerms = suggestedBlock.Terms.ToLower().Split(',')
                                     .Select(str => str.Trim());

                if (suggestedTerms.Contains(queryIntercept))
                {
                    var results = EpiHelper.GetContentAreaContent <IContent>(suggestedBlock.SuggestedResults.Items);

                    foreach (var result in results)
                    {
                        var id = result.ContentLink.ID.ToString();

                        if (!guidList.Contains(id))
                        {
                            guidList.Add(id);
                        }
                    }
                }
            }

            if (guidList.Any())
            {
                var srchClient = SearchFactory <T> .SearchClient;

                foreach (var guid in guidList)
                {
                    var req = new SearchRequest();

                    req.EnableHighlighting = true;
                    req.QueryText          = string.Format("contentid:\"{0}\"", guid);

                    var resp = srchClient.Search(req);

                    if (resp.Results.Any())
                    {
                        suggResults.Add(resp.Results.First());
                    }
                }
            }


            return(suggResults);
        }
Ejemplo n.º 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="srchPage"></param>
        /// <returns></returns>
        public static List <IQueryOption> ReturnQueryOptions(this ISearchPage srchPage)
        {
            var extraParms = new List <IQueryOption>();


            if (srchPage.QueryOptions != null)
            {
                var boostParms = EpiHelper.GetContentAreaContent <BoostQueryBlock> (srchPage.QueryOptions.Items);

                foreach (var bst in boostParms)
                {
                    extraParms.Add(new BoostQuery(bst.FieldName, bst.FieldValue, bst.Boost));
                }

                var filterParms = EpiHelper.GetContentAreaContent <FieldQueryBlock>(srchPage.QueryOptions.Items);

                foreach (var filterBlock in filterParms)
                {
                    var fieldValue = filterBlock.FieldValue;

                    if (filterBlock.FieldName == "pagetype")
                    {
                        if (filterBlock.FieldValue.Contains((" OR ")))
                        {
                            var replaced = filterBlock.FieldValue.Replace(" OR ", "%OR%");
                            fieldValue = replaced.Replace(" ", "").Replace("%OR%", " OR ");
                        }
                        else
                        {
                            fieldValue = filterBlock.FieldValue.Replace(" ", "");
                        }
                    }

                    if (filterBlock.FieldName == "path" && filterBlock.FieldValue.Contains('\\'))
                    {
                        fieldValue = filterBlock.FieldValue.Replace('\\', '/');
                    }

                    if (filterBlock.FieldName == "path" && filterBlock.Condition == FilterQuery.ConditionalTypes.Contains)
                    {
                        extraParms.Add(new FilterQuery("paths", FilterQuery.ConditionalTypes.Equals, fieldValue));
                    }
                    else
                    {
                        extraParms.Add(new FilterQuery(filterBlock.FieldName, filterBlock.Condition, fieldValue));
                    }
                }

                //var queryOptions = srchPage.QueryOptions.FilteredContents.OfType<QueryOptionBlock>();
                var queryOptions = EpiHelper.GetContentAreaContent <QueryOptionBlock>(srchPage.QueryOptions.Items);

                foreach (var option in queryOptions)
                {
                    if (!string.IsNullOrEmpty(option.mm))
                    {
                        extraParms.Add(new DisMaxQueryParm("mm", option.mm));
                    }

                    if (!string.IsNullOrEmpty(option.ps))
                    {
                        extraParms.Add(new DisMaxQueryParm("ps", option.ps));
                    }

                    if (!string.IsNullOrEmpty(option.pf))
                    {
                        extraParms.Add(new DisMaxQueryParm("pf", option.pf));
                    }

                    if (!string.IsNullOrEmpty(option.qf))
                    {
                        extraParms.Add(new DisMaxQueryParm("qf", option.qf));
                    }

                    //extraParms.Add(new QueryParm("qs", option.qs.ToString()));
                }
            }


            return(extraParms);
        }