Exemple #1
0
        public SearchBoxResultModel GetResultModel(SearchBoxModel data)
        {
            var searchSettings = Context.Database.GetItem(ID.Parse(data.SearchSettingsItemId));
            var searchResults  = GetSuggestionResults(data.Keyword, searchSettings);

            return(new SearchBoxResultModel()
            {
                Items = searchResults?.Suggestions?.Select(suggestion => Context.Database.GetItem(suggestion.ItemId)).ToList() ?? new List <Item>()
            });
        }
Exemple #2
0
        private void Switch()
        {
            this.LocationSearchBoxModel.Switch();
            this.DestinationSearchBoxModel.Switch();

            SearchBoxModel tempSearchBoxModel = this.LocationSearchBoxModel;

            this.LocationSearchBoxModel    = this.DestinationSearchBoxModel;
            this.DestinationSearchBoxModel = tempSearchBoxModel;
        }
Exemple #3
0
        public virtual SearchBoxModel PrepareSearchBoxModel()
        {
            var model = new SearchBoxModel
            {
                AutoCompleteEnabled = _catalogSettings.ProductSearchAutoCompleteEnabled,
                ShowProductImagesInSearchAutoComplete = _catalogSettings.ShowProductImagesInSearchAutoComplete,
                SearchTermMinimumLength = _catalogSettings.ProductSearchTermMinimumLength
            };

            return(model);
        }
        public ActionResult SearchBox()
        {
            var model = new SearchBoxModel
            {
                AutoCompleteEnabled = _catalogSettings.ArticleSearchAutoCompleteEnabled,
                ShowArticleImagesInSearchAutoComplete = _catalogSettings.ShowArticleImagesInSearchAutoComplete,
                SearchTermMinimumLength = _catalogSettings.ArticleSearchTermMinimumLength
            };

            return(PartialView(model));
        }
Exemple #5
0
        public ActionResult SearchBox()
        {
            var model = new SearchBoxModel
            {
                AutoCompleteEnabled = true,
                ShowItemImagesInSearchAutoComplete = false,
                SearchTermMinimumLength            = 3
            };

            return(PartialView(model));
        }
        public ActionResult SearchBox()
        {
            var currentTerm = _queryFactory.Current?.Term;

            var model = new SearchBoxModel
            {
                InstantSearchEnabled             = _searchSettings.InstantSearchEnabled,
                ShowProductImagesInInstantSearch = _searchSettings.ShowProductImagesInInstantSearch,
                SearchTermMinimumLength          = _searchSettings.InstantSearchTermMinLength,
                CurrentQuery = currentTerm
            };

            return(PartialView(model));
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var model = new SearchBoxModel
            {
                Origin                    = "Search/Search",
                SearchUrl                 = Url.RouteUrl("Search"),
                InstantSearchUrl          = Url.RouteUrl("InstantSearch"),
                InputPlaceholder          = T("Search.SearchBox.Tooltip"),
                InstantSearchEnabled      = _searchSettings.InstantSearchEnabled && await Services.Permissions.AuthorizeAsync(Permissions.System.AccessShop),
                ShowThumbsInInstantSearch = _searchSettings.ShowProductImagesInInstantSearch,
                SearchTermMinimumLength   = _searchSettings.InstantSearchTermMinLength,
                CurrentQuery              = _queryFactory.Current?.Term
            };

            return(View(model));
        }
        public ActionResult SearchBox()
        {
            var currentTerm = _queryFactory.Current?.Term;

            var model = new SearchBoxModel
            {
                Origin                    = "Search/Search",
                SearchUrl                 = Url.RouteUrl("Search"),
                InstantSearchUrl          = Url.RouteUrl("InstantSearch"),
                InputPlaceholder          = T("Search.SearchBox.Tooltip"),
                InstantSearchEnabled      = _searchSettings.InstantSearchEnabled,
                ShowThumbsInInstantSearch = _searchSettings.ShowProductImagesInInstantSearch,
                SearchTermMinimumLength   = _searchSettings.InstantSearchTermMinLength,
                CurrentQuery              = currentTerm
            };

            return(PartialView(model));
        }
Exemple #9
0
        public ResultListView()
        {
            InitializeComponent();

            BindingContext = new ResultListViewViewModel();

            // total lb
            total = new Label
            {
                HorizontalOptions = LayoutOptions.Fill,
                Text     = "Total match: 0",
                FontSize = 16
            };
            // search bar
            searchBar = new SearchBar
            {
                Placeholder       = "Enter keyword: ",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,

                SearchCommand = new Command(async() =>
                {
                    //resultLabel.Text = "Result: " + searchBar.Text + " is what you want.";
                    string user_input    = searchBar.Text;
                    SearchBoxModel model = new SearchBoxModel(user_input);
                    model.result         = await model.getData_Wildcard();

                    total.Text = "Total match: " + model.result.Count.ToString();

                    ItemList = new ObservableCollection <ResultObj>();
                    foreach (var item in model.result)
                    {
                        ItemList.Add(item);
                    }

                    BindingContext = new ResultListViewViewModel(ItemList);
                })
            };


            headerLayout.Children.Add(searchBar);
            headerLayout.Children.Add(total);
        }
Exemple #10
0
        public ActionResult SearchBoxResult(SearchBoxModel data)
        {
            var model = _repository.GetResultModel(data);

            return(View("/Views/ESearch/SearchBoxResult.cshtml", model));
        }
        private string CreateSearchCriteria(System.Collections.Specialized.NameValueCollection nameValueCollection, SearchBoxModel SearchModel, FormResponseInfoModel Model)
        {
            FormCollection Collection = new FormCollection(nameValueCollection);



            StringBuilder searchBuilder = new StringBuilder();

            if (ValidateSearchFields(Collection))
            {
                if (Collection["col1"].Length > 0 && Collection["val1"].Length > 0)
                {
                    searchBuilder.Append(Collection["col1"] + "='" + Collection["val1"] + "'");
                    SearchModel.SearchCol1 = Collection["col1"];
                    SearchModel.Value1     = Collection["val1"];
                }
                if (Collection["col2"].Length > 0 && Collection["val2"].Length > 0)
                {
                    searchBuilder.Append(" AND " + Collection["col2"] + "='" + Collection["val2"] + "'");
                    SearchModel.SearchCol2 = Collection["col2"];
                    SearchModel.Value2     = Collection["val2"];
                }
                if (Collection["col3"].Length > 0 && Collection["val3"].Length > 0)
                {
                    searchBuilder.Append(" AND " + Collection["col3"] + "='" + Collection["val3"] + "'");
                    SearchModel.SearchCol3 = Collection["col3"];
                    SearchModel.Value3     = Collection["val3"];
                }
                if (Collection["col4"].Length > 0 && Collection["val4"].Length > 0)
                {
                    searchBuilder.Append(" AND " + Collection["col4"] + "='" + Collection["val4"] + "'");
                    SearchModel.SearchCol4 = Collection["col4"];
                    SearchModel.Value4     = Collection["val4"];
                }
                if (Collection["col5"].Length > 0 && Collection["val5"].Length > 0)
                {
                    searchBuilder.Append(" AND " + Collection["col5"] + "='" + Collection["val5"] + "'");
                    SearchModel.SearchCol5 = Collection["col5"];
                    SearchModel.Value5     = Collection["val5"];
                }
            }

            return(searchBuilder.ToString());
        }
        protected string CreateSearchCriteria(NameValueCollection nameValueCollection, SearchBoxModel searchModel, FormResponseInfoModel model)
        {
            FormCollection formCollection = new FormCollection(nameValueCollection);

            StringBuilder searchBuilder = new StringBuilder();

            if (ValidateSearchFields(formCollection))
            {
                if (formCollection["col1"].Length > 0 && formCollection["val1"].Length > 0)
                {
                    searchBuilder.Append(formCollection["col1"] + "='" + formCollection["val1"] + "'");
                    searchModel.SearchCol1 = formCollection["col1"];
                    searchModel.Value1     = formCollection["val1"];
                }
                if (formCollection["col2"].Length > 0 && formCollection["val2"].Length > 0)
                {
                    searchBuilder.Append(" AND " + formCollection["col2"] + "='" + formCollection["val2"] + "'");
                    searchModel.SearchCol2 = formCollection["col2"];
                    searchModel.Value2     = formCollection["val2"];
                }
                if (formCollection["col3"].Length > 0 && formCollection["val3"].Length > 0)
                {
                    searchBuilder.Append(" AND " + formCollection["col3"] + "='" + formCollection["val3"] + "'");
                    searchModel.SearchCol3 = formCollection["col3"];
                    searchModel.Value3     = formCollection["val3"];
                }
                if (formCollection["col4"].Length > 0 && formCollection["val4"].Length > 0)
                {
                    searchBuilder.Append(" AND " + formCollection["col4"] + "='" + formCollection["val4"] + "'");
                    searchModel.SearchCol4 = formCollection["col4"];
                    searchModel.Value4     = formCollection["val4"];
                }
                if (formCollection["col5"].Length > 0 && formCollection["val5"].Length > 0)
                {
                    searchBuilder.Append(" AND " + formCollection["col5"] + "='" + formCollection["val5"] + "'");
                    searchModel.SearchCol5 = formCollection["col5"];
                    searchModel.Value5     = formCollection["val5"];
                }
            }

            return(searchBuilder.ToString());
        }
        public IDictionary <int, KeyValuePair <FieldDigest, string> > ToSearchDigestList(SearchBoxModel searchModel, string formId)
        {
            var searchDigestList = new Dictionary <int, KeyValuePair <FieldDigest, string> >();

            if (!string.IsNullOrWhiteSpace(searchModel.SearchCol1))
            {
                FieldDigest fieldDigest = MetadataAccessor.GetFieldDigestByFieldName(formId, searchModel.SearchCol1);
                searchDigestList.Add(1, new KeyValuePair <FieldDigest, string>(fieldDigest, searchModel.Value1));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.SearchCol2))
            {
                FieldDigest fieldDigest = MetadataAccessor.GetFieldDigestByFieldName(formId, searchModel.SearchCol2);
                searchDigestList.Add(2, new KeyValuePair <FieldDigest, string>(fieldDigest, searchModel.Value2));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.SearchCol3))
            {
                FieldDigest fieldDigest = MetadataAccessor.GetFieldDigestByFieldName(formId, searchModel.SearchCol3);
                searchDigestList.Add(3, new KeyValuePair <FieldDigest, string>(fieldDigest, searchModel.Value3));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.SearchCol4))
            {
                FieldDigest fieldDigest = MetadataAccessor.GetFieldDigestByFieldName(formId, searchModel.SearchCol4);
                searchDigestList.Add(4, new KeyValuePair <FieldDigest, string>(fieldDigest, searchModel.Value4));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.SearchCol5))
            {
                FieldDigest fieldDigest = MetadataAccessor.GetFieldDigestByFieldName(formId, searchModel.SearchCol5);
                searchDigestList.Add(5, new KeyValuePair <FieldDigest, string>(fieldDigest, searchModel.Value5));
            }
            return(searchDigestList);
        }
Exemple #14
0
        public ActionResult SearchBox()
        {
            var model = new SearchBoxModel();

            return(PartialView(model));
        }