Esempio n. 1
0
        public static string GetEquitySearchCriteria(SearchCategory category = SearchCategory.None, CountryCode country = CountryCode.ALL, string name = "", 
			string description = "", bool includeNoLongerTrading = false)
        {
            if (GetAssetType(category) != AssetClass.Equity) throw new ArgumentException("Invalid SearchCategory for Equity search: " + category.ToString(), "category");

            StringBuilder criteria = new StringBuilder();
            if (category != SearchCategory.None) Append(criteria, "c=" + category.ToString());
            if (name != string.Empty) Append(criteria, "n=" + name);
            if (description != string.Empty) Append(criteria, "desc=" + description);
            if (includeNoLongerTrading) Append(criteria, "Flg=true");
            if (country != CountryCode.ALL) Append(criteria, string.Format("cnt={0}", country));

            return criteria.ToString();
        }
Esempio n. 2
0
        private async Task Initialize(SearchCategory Category, bool IngoreCase, bool IncludeRegex, bool GlobleSearch, uint MaxCount)
        {
            HasItem.Visibility = Visibility.Collapsed;

            try
            {
                Cancellation = new CancellationTokenSource();

                if (WeakToFileControl.TryGetTarget(out FileControl Control))
                {
                    string SearchTarget = Control.GlobeSearch.Text;
                    FileSystemStorageFolder CurrentFolder = Control.CurrentPresenter.CurrentFolder;

                    SearchStatus.Text          = Globalization.GetString("SearchProcessingText");
                    SearchStatusBar.Visibility = Visibility.Visible;

                    switch (Category)
                    {
                    case SearchCategory.BuiltInEngine_Deep:
                    case SearchCategory.BuiltInEngine_Shallow:
                    {
                        await foreach (FileSystemStorageItemBase Item in CurrentFolder.SearchAsync(SearchTarget, Category == SearchCategory.BuiltInEngine_Deep, SettingControl.IsDisplayHiddenItem, SettingControl.IsDisplayProtectedSystemItems, IncludeRegex, IngoreCase, Cancellation.Token))
                        {
                            if (Cancellation.IsCancellationRequested)
                            {
                                HasItem.Visibility = Visibility.Visible;
                                break;
                            }
                            else
                            {
                                SearchResult.Insert(SortCollectionGenerator.SearchInsertLocation(SearchResult, Item, SortTarget.Name, SortDirection.Ascending), Item);
                            }
                        }

                        if (SearchResult.Count == 0)
                        {
                            HasItem.Visibility = Visibility.Visible;
                        }

                        break;
                    }

                    case SearchCategory.EverythingEngine:
                    {
                        using (FullTrustProcessController.ExclusiveUsage Exclusive = await FullTrustProcessController.GetAvailableController())
                        {
                            IReadOnlyList <FileSystemStorageItemBase> SearchItems = await Exclusive.Controller.SearchByEverythingAsync(GlobleSearch?string.Empty : CurrentFolder.Path, SearchTarget, IncludeRegex, IngoreCase, MaxCount);

                            if (SearchItems.Count == 0)
                            {
                                HasItem.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                foreach (FileSystemStorageItemBase Item in SortCollectionGenerator.GetSortedCollection(SearchItems, SortTarget.Name, SortDirection.Ascending))
                                {
                                    SearchResult.Add(Item);
                                }
                            }
                        }

                        break;
                    }
                    }

                    SearchStatus.Text          = Globalization.GetString("SearchCompletedText");
                    SearchStatusBar.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception ex)
            {
                LogTracer.Log(ex, $"An error was threw in {nameof(Initialize)}");
            }
            finally
            {
                Cancellation.Dispose();
                Cancellation = null;
            }
        }
Esempio n. 3
0
		void ShowResult (SearchCategory cat, IReadOnlyList<SearchResult> result)
		{
			bool found = false;
			for (int i = 0; i < incompleteResults.Count; i++) {
				var ir = incompleteResults [i];
				if (ir.Item1 == cat) {
					incompleteResults[i] = Tuple.Create (cat, result);
					found = true;
					break;
				}
			}
			if (!found) {
				incompleteResults.Add (Tuple.Create (cat, result));
				incompleteResults.Sort ((x, y) => {
					return categories.IndexOf (x.Item1).CompareTo (categories.IndexOf (y.Item1));
				});
			}

			//if (incompleteResults.Count == categories.Count) 
			{
				results.Clear ();
				results.AddRange (incompleteResults);
				List<Tuple<SearchCategory, IReadOnlyList<SearchResult>>> failedResults = null;
				topItem = null;

				for (int i = 0; i < results.Count; i++) {
					var tuple = results [i];
					try {
						if (tuple.Item2.Count == 0)
							continue;
						if (topItem == null || topItem.DataSource[topItem.Item].Weight < tuple.Item2[0].Weight)
							topItem = new ItemIdentifier(tuple.Item1, tuple.Item2, 0);
					} catch (Exception e) {
						LoggingService.LogError ("Error while showing result " + i, e);
						if (failedResults == null)
							failedResults = new List<Tuple<SearchCategory, IReadOnlyList<SearchResult>>> ();
						failedResults.Add (results [i]);
						continue;
					}
				}
				selectedItem = topItem;

				if (failedResults != null)
					failedResults.ForEach (failedResult => results.Remove (failedResult));

				ShowTooltip ();

			}
		}
Esempio n. 4
0
        private void OptionSymbolSearchAsync(SearchCategory category, string symbolRoot,
			uint strikeCount = 3, decimal strikePriceLow = 0, decimal strikePriceHigh = decimal.MaxValue,
			uint dateCount = 3, DateTime? expirationDateLow = null, DateTime? expirationDateHigh = null,
			OptionType optionType = OptionType.Both, FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US,
			int timeout = TimeoutDefault)
        {
            OptionSymbolSearchCompletedTask task = OptionSymbolSearch;
            AsyncCallback callback = OptionSymbolSearchCompletedCallback;
            task.BeginInvoke(category, symbolRoot, strikeCount, strikePriceLow, strikePriceHigh, dateCount, expirationDateLow, expirationDateHigh, optionType, futureType,
                symbolType, country, timeout, callback, null);
        }
Esempio n. 5
0
        /// <summary>
        /// Select unique search categories, which are used in search UI.
        /// </summary>
        private void UpdateSearchCategories()
        {
            var uniqueCategoryNames = searchResults.Select(x => x.Category).Distinct();

            var categories = new List<SearchCategory>();
            foreach (var name in uniqueCategoryNames)
            {
                var searchCategory = new SearchCategory(name);
                searchCategory.PropertyChanged += IsSelectedChanged;
                categories.Add(searchCategory);
            }
            SearchCategories = categories;
        }
Esempio n. 6
0
        public static bool UpdateUI(SearchCategory category)
        {
            switch (category)
            {
            case SearchCategory.FaceEyeIris:
                var listFIris = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_eyeblack);
                Traverse.Create(AI_MakerSearch.cvsEye).Field("sscBlackType").Method("CreateList", listFIris).GetValue();

                AI_MakerSearch.cvsEye.UpdateCustomUI();
                break;

            case SearchCategory.FaceEyePupil:
                var listFPupil = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_eye);
                Traverse.Create(AI_MakerSearch.cvsEye).Field("sscPupilType").Method("CreateList", listFPupil).GetValue();

                AI_MakerSearch.cvsEye.UpdateCustomUI();
                break;

            case SearchCategory.FaceMole:
                var listFMole = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_mole);
                Traverse.Create(AI_MakerSearch.cvsMole).Field("sscMole").Method("CreateList", listFMole).GetValue();

                AI_MakerSearch.cvsMole.UpdateCustomUI();
                break;

            case SearchCategory.FaceHighlight:
                var listFHighlight = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_eye_hl);
                Traverse.Create(AI_MakerSearch.cvsHighlight).Field("sscEyeHLType").Method("CreateList", listFHighlight).GetValue();

                AI_MakerSearch.cvsHighlight.UpdateCustomUI();
                break;

            case SearchCategory.FaceEyebrow:
                var listFEyebrow = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_eyebrow);
                Traverse.Create(AI_MakerSearch.cvsEyebrow).Field("sscEyebrowType").Method("CreateList", listFEyebrow).GetValue();

                AI_MakerSearch.cvsEyebrow.UpdateCustomUI();
                break;

            case SearchCategory.FaceEyelash:
                var listFEyelash = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_eyelash);
                Traverse.Create(AI_MakerSearch.cvsEyelash).Field("sscEyelashesType").Method("CreateList", listFEyelash).GetValue();

                AI_MakerSearch.cvsEyelash.UpdateCustomUI();
                break;

            case SearchCategory.FaceEyeshadow:
                var listFEyeshadow = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_eyeshadow);
                Traverse.Create(AI_MakerSearch.cvsEyeshadow).Field("sscEyeshadowType").Method("CreateList", listFEyeshadow).GetValue();

                AI_MakerSearch.cvsEyelash.UpdateCustomUI();
                break;

            case SearchCategory.FaceCheek:
                var listFCheek = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_cheek);
                Traverse.Create(AI_MakerSearch.cvsCheek).Field("sscCheekType").Method("CreateList", listFCheek).GetValue();

                AI_MakerSearch.cvsEyelash.UpdateCustomUI();
                break;

            case SearchCategory.FaceLip:
                var listFLip = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_lip);
                Traverse.Create(AI_MakerSearch.cvsLip).Field("sscLipType").Method("CreateList", listFLip).GetValue();

                AI_MakerSearch.cvsEyelash.UpdateCustomUI();
                break;

            case SearchCategory.FacePaint:
                var listFPaint = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_paint);
                Traverse.Create(AI_MakerSearch.cvsFacePaint).Field("sscPaintType").Method("CreateList", listFPaint).GetValue();

                AI_MakerSearch.cvsEyelash.UpdateCustomUI();
                break;

            case SearchCategory.BodySkin:
                var listBSkin = CvsBase.CreateSelectList(AI_MakerSearch.sex == 0 ? ChaListDefine.CategoryNo.mt_skin_b : ChaListDefine.CategoryNo.ft_skin_b);
                Traverse.Create(AI_MakerSearch.cvsSkin).Field("sscSkinType").Method("CreateList", listBSkin).GetValue();

                AI_MakerSearch.cvsSkin.UpdateCustomUI();
                break;

            case SearchCategory.BodyDetail:
                var listBDetail = CvsBase.CreateSelectList(AI_MakerSearch.sex == 0 ? ChaListDefine.CategoryNo.mt_detail_b : ChaListDefine.CategoryNo.ft_detail_b);
                Traverse.Create(AI_MakerSearch.cvsSkin).Field("sscDetailType").Method("CreateList", listBDetail).GetValue();

                AI_MakerSearch.cvsSkin.UpdateCustomUI();
                break;

            case SearchCategory.BodySunburn:
                var listBSunburn = CvsBase.CreateSelectList(AI_MakerSearch.sex == 0 ? ChaListDefine.CategoryNo.mt_sunburn : ChaListDefine.CategoryNo.ft_sunburn);
                Traverse.Create(AI_MakerSearch.cvsSunburn).Field("sscSunburnType").Method("CreateList", listBSunburn).GetValue();

                AI_MakerSearch.cvsSunburn.UpdateCustomUI();
                break;

            case SearchCategory.BodyNip:
                var listBNip = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_nip);
                Traverse.Create(AI_MakerSearch.cvsNip).Field("sscNipType").Method("CreateList", listBNip).GetValue();

                AI_MakerSearch.cvsNip.UpdateCustomUI();
                break;

            case SearchCategory.BodyUnderhair:
                var listBUnderhair = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_underhair);
                Traverse.Create(AI_MakerSearch.cvsUnderhair).Field("sscUnderhairType").Method("CreateList", listBUnderhair).GetValue();

                AI_MakerSearch.cvsUnderhair.UpdateCustomUI();
                break;

            case SearchCategory.BodyPaint:
                var listBPaint = CvsBase.CreateSelectList(ChaListDefine.CategoryNo.st_paint);
                Traverse.Create(AI_MakerSearch.cvsPaint).Field("sscPaintType").Method("CreateList", listBPaint).GetValue();

                AI_MakerSearch.cvsPaint.UpdateCustomUI();
                break;

            case SearchCategory.Hair:
                AI_MakerSearch.cvsHair.UpdateHairList();
                AI_MakerSearch.cvsHair.UpdateCustomUI();
                break;

            case SearchCategory.Clothes:
                AI_MakerSearch.cvsClothes.UpdateClothesList();
                AI_MakerSearch.cvsClothes.UpdateCustomUI();
                break;

            case SearchCategory.Accessories:
                AI_MakerSearch.cvsAccessories.UpdateAcsList();
                AI_MakerSearch.cvsAccessories.UpdateCustomUI();
                break;

            case SearchCategory.Extra:
                return(false);

            case SearchCategory.None:
                return(false);

            default:
                return(false);
            }

            return(true);
        }
        public PagedSearchResponse <AccountSearchModel> FindAccounts(string searchText, SearchCategory searchType, int pageSize = 10, int pageNumber = 1)
        {
            if (searchType != SearchCategory.Account)
            {
                return(null);
            }
            _indexAliasName = _indexNameCreator.CreateIndexesAliasName(_searchSettings.IndexName, searchType);

            var response = _elasticSearchClient.Search <AccountSearchModel>(s => s.Index(_indexAliasName)
                                                                            .Skip(pageSize * GetPage(pageNumber))
                                                                            .Take(pageSize)
                                                                            .Query(q => q
                                                                                   .Bool(b => b
                                                                                         .Should(m =>
                                                                                                 m.QueryString(qs => qs.Query($"*{searchText }*").AnalyzeWildcard(true).Fields(f => f.Field(fs => fs.Account)))
                                                                                                 ||
                                                                                                 m.QueryString(qs => qs.Query($"*{searchText }*").AnalyzeWildcard(true).Fields(f => f.Field(fs => fs.AccountSearchKeyWord)))
                                                                                                 ||
                                                                                                 m.Match(mt => mt.Query(searchText).Field(fs => fs.AccountSearchKeyWord))
                                                                                                 ||
                                                                                                 m.Match(mt => mt.Query(searchText).Field(fs => fs.AccountIDSearchKeyWord))
                                                                                                 ||
                                                                                                 m.Match(mt => mt.Query(searchText).Field(fs => fs.PublicAccountIDSearchKeyWord))
                                                                                                 ||
                                                                                                 m.Match(mt => mt.Query(searchText).Field(fs => fs.PayeSchemeIdSearchKeyWords))
                                                                                                 )))
                                                                            .Sort(sort => sort.Descending(SortSpecialField.Score).Ascending(a => a.AccountSearchKeyWord))
                                                                            , string.Empty);

            ValidateResponse(response);

            return(GetSearchResponse(pageSize, response));
        }
        public static async Task <SearchResults> Search(string searchTerm, bool strict, SearchCategory category)
        {
            EnsureInit();

            EsiResponse <SearchResults> Search_response = await s_client.Search.Query(SearchType.Public, searchTerm, category, strict);

            if (Search_response.StatusCode != HttpStatusCode.OK)
            {
                s_Log.LogError("{0} error searching API '{1}': {2}", Search_response.StatusCode, Search_response.Endpoint, Search_response.Message);
                return(null);
            }

            return(Search_response.Data);
        }
Esempio n. 9
0
        public void OptionSymbolSearchAsync(SearchCategory category, string symbolRoot)
        {
            // call full overload with all params (defaults)

            // ReSharper disable RedundantArgumentName
            OptionSymbolSearchAsync(category: category, symbolRoot: symbolRoot, strikeCount: 3, strikePriceLow: 0);
            // ReSharper restore RedundantArgumentName
        }
Esempio n. 10
0
        /// <summary>
        /// Allows searching by strike range and date range.
        /// </summary>
        public List<Symbol> OptionSymbolSearch(SearchCategory category, string symbolRoot, decimal strikePriceLow, decimal strikePriceHigh,
			DateTime? expirationDateLow = null, DateTime? expirationDateHigh = null, OptionType optionType = OptionType.Both, FutureType futureType = FutureType.Electronic,
			SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US, int timeout = TimeoutDefault)
        {
            // call full overload with all params (defaults)
            // ReSharper disable RedundantArgumentName
            return OptionSymbolSearch(category: category, symbolRoot: symbolRoot, strikeCount: 3, strikePriceLow: strikePriceLow, strikePriceHigh: strikePriceHigh,
            dateCount: 3, expirationDateLow: expirationDateLow, expirationDateHigh: expirationDateHigh, optionType: optionType, futureType: futureType,
            symbolType: symbolType, country: country, timeout: timeout);
            // ReSharper restore RedundantArgumentName
        }
Esempio n. 11
0
        /*
         Option Symbol Search can either be called by passing a combination of strikecount or strike range with a datacount or date range (4 possible combinations). The 4 public overloads
         expose this functionality.
         */
        /// <summary>
        /// Allows searching by strike count and date count.
        /// </summary>
        public List<Symbol> OptionSymbolSearch(SearchCategory category, string symbolRoot, uint strikeCount = 3, uint dateCount = 3, OptionType optionType = OptionType.Both,
			FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US, int timeout = TimeoutDefault)
        {
            // call full overload with all params (defaults)
            return OptionSymbolSearch(category, symbolRoot, strikeCount, 0, decimal.MaxValue, dateCount, null, null, optionType, futureType, symbolType, country, timeout);
        }
Esempio n. 12
0
 /// <summary>
 /// Stripped down overload: category and symbol only, assume defaults for all missing params.
 /// </summary>
 /// <param name="category"></param>
 /// <param name="symbolRoot"></param>
 /// <returns></returns>
 public List<Symbol> OptionSymbolSearch(SearchCategory category, string symbolRoot)
 {
     // ReSharper disable RedundantArgumentName
     return OptionSymbolSearch(category: category, symbolRoot: symbolRoot, strikeCount: 3, strikePriceLow: 0);
     // ReSharper restore RedundantArgumentName
 }
Esempio n. 13
0
 public void FundSymbolSearchAsync(SearchCategory category, string description = "", string symbol = "", CountryCode country = CountryCode.ALL, int timeout = TimeoutDefault)
 {
     FundSymbolSearchTask task = FundSymbolSearch;
     AsyncCallback callback = FundSymbolSearchCompletedCallback;
     task.BeginInvoke(category, description, symbol, country, timeout, callback, null);
 }
Esempio n. 14
0
        public List<Symbol> FundSymbolSearch(SearchCategory category, string description = "", string symbol = "", CountryCode country = CountryCode.ALL, int timeout = TimeoutDefault)
        {
            if (category != SearchCategory.MutualFund && category != SearchCategory.MoneyMarketFund) throw new ArgumentException("Invalid SearchCategory, should be MutualFund or MoneyMarketFund.", "category");

            string criteria = SymbolSearch.GetEquitySearchCriteria(category, country, symbol, description);
            Uri uri = new Uri(root, string.Format("/v2/data/symbols/search/{0}",
                criteria));
            string response = TryGet(uri, timeout);
            return JsonConvert.DeserializeObject<List<Symbol>>(response, new CountryCodeConverter());
        }
Esempio n. 15
0
        public string CreateIndexesAliasName(string indexName, SearchCategory searchCategory)
        {
            var indexType = Enum.GetName(typeof(SearchCategory), searchCategory);

            return($"{indexName}-{indexType}".ToLower());
        }
Esempio n. 16
0
        public static ManagedProperty CreateManagedProperty(SPSite site, string name, string crawledName, ManagedDataType type,
                                                            SearchCategory searchCategory = SearchCategory.SharePoint, bool searchable = true, bool refinable = true,
                                                            bool retrievable        = true, bool sortable = true, bool hasMultipleValues = false, bool safeForAnonymous = false,
                                                            bool tokenNormalization = false)
        {
            // Get the default service context
            var context = SearchContext.GetContext(site);

            // Get the schema of our Search Service Application
            Schema schema = new Schema(context);

            if (schema.AllManagedProperties.SingleOrDefault(i => i.Name == name) != null)
            {
                Logger.Logger.Debug("SearchUtils.CreateManagedProperty", $"The property \"{name}\" already exists.");
                return(null);
            }

            var categoryName = Enum.GetName(typeof(SearchCategory), searchCategory).Replace("_", " ");

            Category category = schema.AllCategories.Single(i => i.Name == categoryName);

            CrawledProperty crawledProperty =
                category.GetAllCrawledProperties().SingleOrDefault(i => i.Name == crawledName);

            if (crawledProperty != null)
            {
                // Get all the managed properties
                ManagedPropertyCollection properties = schema.AllManagedProperties;

                // Add a new property
                ManagedProperty property = properties.Create(name, type);
                property.Searchable         = searchable;
                property.Refinable          = refinable;
                property.Retrievable        = retrievable;
                property.Sortable           = sortable;
                property.HasMultipleValues  = hasMultipleValues;
                property.TokenNormalization = tokenNormalization;
                property.SafeForAnonymous   = safeForAnonymous;

                // Get the current mappings
                MappingCollection mappings = property.GetMappings();

                // Add a new mapping to a previously crawled field
                var myMapping = new Mapping();
                myMapping.CrawledPropertyName = crawledProperty.Name;
                myMapping.CrawledPropset      = crawledProperty.Propset;
                myMapping.ManagedPid          = property.PID;

                // Add the mapping
                mappings.Add(myMapping);

                // Update the collection of mappings
                property.SetMappings(mappings);

                // Write the changes back
                property.Update();

                return(property);
            }

            return(null);
        }
Esempio n. 17
0
        public void OptionSymbolSearchAsync(SearchCategory category, string symbolRoot, DateTime expirationDateLow, DateTime expirationDateHigh, uint strikeCount = 3,
			OptionType optionType = OptionType.Both, FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite,
			CountryCode country = CountryCode.US, int timeout = TimeoutDefault)
        {
            // call full overload with all params (defaults)
            // ReSharper disable RedundantArgumentName
            OptionSymbolSearchAsync(category: category, symbolRoot: symbolRoot, strikeCount: strikeCount, strikePriceLow: 0, strikePriceHigh: decimal.MaxValue, dateCount: 3,
            expirationDateLow: expirationDateLow, expirationDateHigh: expirationDateHigh, optionType: optionType, futureType: futureType, symbolType: symbolType,
            country: country, timeout: timeout);
            // ReSharper restore RedundantArgumentName
        }
Esempio n. 18
0
        private IQueryable <ProfileEntity> CalculateSearchProfilePredicate(IQueryable <ProfileEntity> query, Gender gender, SearchCategory searchFor)
        {
            if (gender == Gender.Male && searchFor == SearchCategory.Women) //Hetro male
            {
                query = query.Where(p => p.Gender == 1 && p.SearchForCategory == 0);
            }
            else if (gender == Gender.Male && searchFor == SearchCategory.Men) //H**o male
            {
                query = query.Where(p => p.Gender == 0 && p.SearchForCategory == 0);
            }
            else if (gender == Gender.Male && searchFor == SearchCategory.Both) //Bi male
            {
                query = query.Where(p => (p.Gender == 1 && p.SearchForCategory == 0) ||
                                    (p.Gender == 0 && p.SearchForCategory == 0));
            }
            else if (gender == Gender.Female && searchFor == SearchCategory.Men) //Hetro female
            {
                query = query.Where(p => p.Gender == 0 && p.SearchForCategory == 1);
            }
            else if (gender == Gender.Female && searchFor == SearchCategory.Women) //H**o female
            {
                query = query.Where(p => p.Gender == 1 && p.SearchForCategory == 1);
            }
            else if (gender == Gender.Female && searchFor == SearchCategory.Both) //Bi female
            {
                query = query.Where(p => (p.Gender == 0 && p.SearchForCategory == 1) ||
                                    (p.Gender == 1 && p.SearchForCategory == 1));
            }

            return(query);
        }
Esempio n. 19
0
        public void OptionSymbolSearchAsync(SearchCategory category, string symbolRoot, decimal strikePriceLow, decimal strikePriceHigh,
			DateTime expirationDateLow, DateTime expirationDateHigh, OptionType optionType = OptionType.Both, FutureType futureType = FutureType.Electronic,
			SymbolType symbolType = SymbolType.Composite,
			CountryCode country = CountryCode.US, int timeout = TimeoutDefault)
        {
            // call full overload with all params (defaults)
            OptionSymbolSearchAsync(category, symbolRoot, 3, strikePriceLow, strikePriceHigh, 3, expirationDateLow, expirationDateHigh, optionType, futureType, symbolType, country, timeout);
        }
Esempio n. 20
0
        /// <summary>
        /// /search/ and /characters/{character_id}/search/
        /// </summary>
        /// <param name="search">The string to search on</param>
        /// <param name="categories">Type of entities to search for</param>
        /// <param name="isStrict">Whether the search should be a strict match</param>
        /// <param name="language">Language to use in the response</param>
        /// <returns></returns>
        public async Task <EsiResponse <SearchResults> > Query(SearchType type, string search, SearchCategory categories, bool isStrict = false, string language = "en-us")
        {
            var categoryList = categories.ToEsiValue();

            var endpoint = "/search/";
            Dictionary <string, string> replacements = null;
            RequestSecurity             security     = RequestSecurity.Public;

            if (type == SearchType.Character)
            {
                security     = RequestSecurity.Authenticated;
                replacements = new Dictionary <string, string>()
                {
                    { "character_id", character_id.ToString() }
                };
                endpoint = "/characters/{character_id}/search/";
            }

            var response = await Execute <SearchResults>(_client, _config, security, RequestMethod.Get, endpoint, replacements, parameters : new string[] {
                $"search={search}",
                $"categories={categoryList}",
                $"strict={isStrict}",
                $"language={language}"
            },
                                                         token : _data?.Token);

            return(response);
        }
Esempio n. 21
0
        public async Task <List <Problem> > SearchProblemsAsync(string term, SearchCategory category)
        {
            var document = await client.HttpClient.GetHtmlDocumentAsync($"https://udebug.com/?search_string={term}&search_category={(int)category}");

            return(document.DocumentNode.Descendants("tbody").FirstOrDefault()?.Descendants("tr").Select(ExtractProblem).ToList());
        }
Esempio n. 22
0
			public SearchResultCollector (SearchCategory cat)
			{
				this.Category = cat;
			}
Esempio n. 23
0
 /// <summary>Perform Public Search</summary>
 /// <param name="Query">(String) Search Query</param>
 /// <param name="Category">(SearchCategory) Category to search</param>
 /// <param name="Strict">(Boolean) Strictly match query</param>
 /// <returns>EsiRequest</returns>
 public EsiRequest SearchPublic(string Query, SearchCategory Category, bool Strict)
 {
     return(SearchPublic(Query, new string[] { Category.Value }, Strict, Language.English));
 }
		void ShowResult (SearchCategory cat, ISearchDataSource result)
		{
			incompleteResults.Add (Tuple.Create (cat, result));

			incompleteResults.Sort ((x, y) => {
				return categories.IndexOf (x.Item1).CompareTo (categories.IndexOf (y.Item1));
			}
			);

			if (incompleteResults.Count == categories.Count) {
				results.Clear ();
				results.AddRange (incompleteResults);
				List<Tuple<SearchCategory, ISearchDataSource>> failedResults = null;
				topItem = null;

				for (int i = 0; i < results.Count; i++) {
					var tuple = results [i];
					try {
						if (tuple.Item2.ItemCount == 0)
							continue;
						if (topItem == null || topItem.DataSource.GetWeight (topItem.Item) < tuple.Item2.GetWeight (0))
							topItem = new ItemIdentifier(tuple.Item1, tuple.Item2, 0);
					} catch (Exception e) {
						LoggingService.LogError ("Error while showing result " + i, e);
						if (failedResults == null)
							failedResults = new List<Tuple<SearchCategory, ISearchDataSource>> ();
						failedResults.Add (results [i]);
						continue;
					}
				}
				selectedItem = topItem;

				if (failedResults != null)
					failedResults.ForEach (failedResult => results.Remove (failedResult));

				ShowTooltip ();
				isInSearch = false;
				AnimatedResize ();
			}
		}
Esempio n. 25
0
 public TripOptionModel()
 {
     this.SearchCategory = SearchCategory.Unspecified;
 }
Esempio n. 26
0
			public SearchResultCollector (SearchPopupWindow parent, SearchCategory cat)
			{
				this.parent = parent;
				this.Category = cat;
			}
Esempio n. 27
0
 public void SetAsAddress(Address address)
 {
     SearchCategory = Enums.SearchCategory.Address;
     this.Address   = address;
 }
Esempio n. 28
0
        private async Task <PagedResult <BaseRowViewModel> > SearchForCategory(string query, SearchCategory searchCategory, int page)
        {
            PagedResult <BaseRowViewModel> result = null;

            switch (searchCategory)
            {
            case SearchCategory.Movies:
                var movies = await _searchService.SearchMoviesAsync(query, page, PageSize);

                result = _mapper.Map <PagedResult <BaseRowViewModel> >(movies);
                break;

            case SearchCategory.People:
                var people = await _searchService.SearchPeopleAsync(query, page, PageSize);

                result = _mapper.Map <PagedResult <BaseRowViewModel> >(people);

                break;
            }
            return(result);
        }
Esempio n. 29
0
        /// <summary>
        /// Private method which exposes all possible parameters, with default values for the optional ones.
        /// </summary>
        /// <param name="category">Category=StockOption, IndexOption, FutureOption or CurrencyOption</param>
        /// <param name="symbolRoot">Symbol root. Required Field, the symbol the option is a derivative of, this search will not return options based on a partial root.</param>
        /// <param name="strikeCount">Number of strikes prices above and below the underlying price. Defaults to 3. Ignored if strike price high and low are passed.</param>
        /// <param name="strikePriceLow">Strike price low</param>
        /// <param name="strikePriceHigh">Strike price high</param>
        /// <param name="dateCount">Number of expiration dates. Default value 3. Ignored if expiration dates high and low are passed.</param>
        /// <param name="expirationDateLow">Expiration date low</param>
        /// <param name="expirationDateHigh">Expiration date high</param>
        /// <param name="optionType">Option type (Both, Call, Put) Default: Both</param>
        /// <param name="futureType">Future type (Electronic, Pit) Default: Electronic</param>
        /// <param name="symbolType">SymbolType (Both, Composite, Regional) Default: Composite</param>
        /// <param name="country">Country code (US, DE, CA) Default: US</param>
        /// <returns></returns>
        public static string GetOptionSearchCriteria(SearchCategory category, string symbolRoot,
			uint strikeCount = 3, decimal strikePriceLow = 0, decimal strikePriceHigh = decimal.MaxValue, 
			uint dateCount = 3, DateTime? expirationDateLow = null, DateTime? expirationDateHigh = null,
			OptionType optionType = OptionType.Both, 
			FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US)
        {
            if (string.IsNullOrEmpty(symbolRoot)) throw new ArgumentException("symbolRoot is required.", "symbolRoot");
            if (GetAssetType(category) != AssetClass.Option) throw new ArgumentException("SearchCategory must be StockOption, IndexOption, FutureOption or CurrencyOption", "category");
            if (strikePriceLow < 0) throw new ArgumentOutOfRangeException("strikePriceLow", "Argument cannot be less than 0.");
            if (strikePriceHigh < 0) throw new ArgumentOutOfRangeException("strikePriceHigh", "Argument cannot be less than 0.");
            if ((expirationDateLow.HasValue && !expirationDateHigh.HasValue) || (expirationDateHigh.HasValue && !expirationDateLow.HasValue)) throw new ArgumentException("If either expiration date parameter is passed, both must be passed.");
            if (expirationDateHigh.HasValue && expirationDateLow.HasValue && expirationDateHigh < expirationDateLow) throw new ArgumentOutOfRangeException("expirationDateHigh", "expirationDateHigh cannot be before expirationDateLow.");

            StringBuilder criteria = new StringBuilder(255);
            Append(criteria, "c=" + category.ToString());
            Append(criteria, "R=" + symbolRoot);
            // strike price range takes precidence over strike count
            if (strikePriceLow > 0 && strikePriceHigh < decimal.MaxValue)
            {
                Append(criteria, "Spl=" + strikePriceLow);
                Append(criteria, "Sph=" + strikePriceHigh);
            }
            else if (strikeCount != 3)
                Append(criteria, "Stk=" + strikeCount);

            // daterange takes precidence over datacount
            if (expirationDateLow.HasValue)
            {
                Append(criteria, "Edl=" + ((DateTime)expirationDateLow).ToString("MM-dd-yyyy"));
                Append(criteria, "Edh=" + ((DateTime)expirationDateHigh).ToString("MM-dd-yyyy"));
            }
            else if (dateCount != 3)
                Append(criteria, "Exd=" + dateCount);

            if (optionType != OptionType.Both) Append(criteria, "OT=" + optionType.ToString());
            if (futureType != FutureType.Electronic) Append(criteria, "FT=" + futureType.ToString());
            if (symbolType != SymbolType.Composite) Append(criteria, "ST=" + symbolType.ToString());
            if (country != CountryCode.US) Append(criteria, "Cnt=" + country.ToString());

            return criteria.ToString();
        }
Esempio n. 30
0
        public string CreateNewIndexName(string indexName, SearchCategory searchCategory)
        {
            var aliasName = CreateIndexesAliasName(indexName, searchCategory);

            return($"{aliasName}_{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}".ToLower());
        }
Esempio n. 31
0
        private static AssetClass GetAssetType(SearchCategory category)
        {
            if (category.ToString().EndsWith("Option"))
                return AssetClass.Option;

            if(category == SearchCategory.Future || category == SearchCategory.FutureRoot)
                return AssetClass.Future;

            if (category == SearchCategory.Forex)
                return AssetClass.Forex;

            return AssetClass.Equity;
        }
Esempio n. 32
0
        /// <summary>
        /// Private method which exposes all possible parameters, with default values for the optional ones.
        /// </summary>
        /// <param name="category">Category=StockOption, IndexOption, FutureOption or CurrencyOption</param>
        /// <param name="symbolRoot">Symbol root. Required Field, the symbol the option is a derivative of, this search will not return options based on a partial root.</param>
        /// <param name="strikeCount">Number of strikes prices above and below the underlying price. Defaults to 3. Ignored if strike price high and low are passed.</param>
        /// <param name="strikePriceLow">Strike price low</param>
        /// <param name="strikePriceHigh">Strike price high</param>
        /// <param name="dateCount">Number of expiration dates. Default value 3. Ignored if expiration dates high and low are passed.</param>
        /// <param name="expirationDateLow">Expiration date low</param>
        /// <param name="expirationDateHigh">Expiration date high</param>
        /// <param name="optionType">Option type (Both, Call, Put) Default: Both</param>
        /// <param name="futureType">Future type (Electronic, Pit) Default: Electronic</param>
        /// <param name="symbolType">SymbolType (Both, Composite, Regional) Default: Composite</param>
        /// <param name="country">Country code (US, DE, CA) Default: US</param>
        /// <returns></returns>
        public static string GetOptionSearchCriteria(SearchCategory category, string symbolRoot,
                                                     uint strikeCount      = 3, decimal strikePriceLow     = 0, decimal strikePriceHigh        = decimal.MaxValue,
                                                     uint dateCount        = 3, DateTime?expirationDateLow = null, DateTime?expirationDateHigh = null,
                                                     OptionType optionType = OptionType.Both,
                                                     FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US)
        {
            if (string.IsNullOrEmpty(symbolRoot))
            {
                throw new ArgumentException("symbolRoot is required.", "symbolRoot");
            }
            if (GetAssetType(category) != AssetClass.Option)
            {
                throw new ArgumentException("SearchCategory must be StockOption, IndexOption, FutureOption or CurrencyOption", "category");
            }
            if (strikePriceLow < 0)
            {
                throw new ArgumentOutOfRangeException("strikePriceLow", "Argument cannot be less than 0.");
            }
            if (strikePriceHigh < 0)
            {
                throw new ArgumentOutOfRangeException("strikePriceHigh", "Argument cannot be less than 0.");
            }
            if ((expirationDateLow.HasValue && !expirationDateHigh.HasValue) || (expirationDateHigh.HasValue && !expirationDateLow.HasValue))
            {
                throw new ArgumentException("If either expiration date parameter is passed, both must be passed.");
            }
            if (expirationDateHigh.HasValue && expirationDateLow.HasValue && expirationDateHigh < expirationDateLow)
            {
                throw new ArgumentOutOfRangeException("expirationDateHigh", "expirationDateHigh cannot be before expirationDateLow.");
            }


            StringBuilder criteria = new StringBuilder(255);

            Append(criteria, "c=" + category.ToString());
            Append(criteria, "R=" + symbolRoot);
            // strike price range takes precidence over strike count
            if (strikePriceLow > 0 && strikePriceHigh < decimal.MaxValue)
            {
                Append(criteria, "Spl=" + strikePriceLow);
                Append(criteria, "Sph=" + strikePriceHigh);
            }
            else if (strikeCount != 3)
            {
                Append(criteria, "Stk=" + strikeCount);
            }

            // daterange takes precidence over datacount
            if (expirationDateLow.HasValue)
            {
                Append(criteria, "Edl=" + ((DateTime)expirationDateLow).ToString("MM-dd-yyyy"));
                Append(criteria, "Edh=" + ((DateTime)expirationDateHigh).ToString("MM-dd-yyyy"));
            }
            else if (dateCount != 3)
            {
                Append(criteria, "Exd=" + dateCount);
            }

            if (optionType != OptionType.Both)
            {
                Append(criteria, "OT=" + optionType.ToString());
            }
            if (futureType != FutureType.Electronic)
            {
                Append(criteria, "FT=" + futureType.ToString());
            }
            if (symbolType != SymbolType.Composite)
            {
                Append(criteria, "ST=" + symbolType.ToString());
            }
            if (country != CountryCode.US)
            {
                Append(criteria, "Cnt=" + country.ToString());
            }

            return(criteria.ToString());
        }
        public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, Cursor cursor = null, SearchCategory searchCategory = SearchCategory.Any, SortCriteria sortCriteria = SortCriteria.Ranked, SortDirection sortDirection = SortDirection.Descending)
        {
            this.query   = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
            this.ruleset = ruleset;
            this.cursor  = cursor;

            SearchCategory = searchCategory;
            SortCriteria   = sortCriteria;
            SortDirection  = sortDirection;
            Genre          = SearchGenre.Any;
            Language       = SearchLanguage.Any;
        }
Esempio n. 34
0
        private void PopulateSearchCategories(IEnumerable<NodeSearchElement> nodes)
        {
            foreach (NodeSearchElement node in nodes)
            {
                var rootCategoryName = NodeSearchElement.SplitCategoryName(node.FullCategoryName).FirstOrDefault();

                var category = searchRootCategories.FirstOrDefault(sc => sc.Name == rootCategoryName);
                if (category == null)
                {
                    category = new SearchCategory(rootCategoryName);
                    searchRootCategories.Add(category);
                }

                var elementVM = MakeNodeSearchElementVM(node);
                elementVM.Category = GetCategoryViewModel(libraryRoot, node.Categories);

                category.AddMemberToGroup(elementVM);
            }

            if (nodes.Count() == 0)
                return;

            // Clone top node.
            var topNode = new NodeSearchElementViewModel(MakeNodeSearchElementVM(nodes.First()));
            topNode.IsTopResult = true;

            SortSearchCategoriesChildren();

            var topCategory = new SearchCategory(Dynamo.Wpf.Properties.Resources.SearchViewTopResult, true);
            topCategory.AddMemberToGroup(topNode);
            searchRootCategories.Insert(0, topCategory);

            selectionNavigator.UpdateRootCategories(SearchRootCategories);
        }
Esempio n. 35
0
 public SearchConditionEntry(string name, SearchCategory cate)
 {
     this.Name = name;
     this.Category = cate;
 }
Esempio n. 36
0
        private async Task Initialize(SearchCategory Category, bool IngoreCase, bool IncludeRegex, bool GlobleSearch, uint MaxCount)
        {
            HasItem.Visibility = Visibility.Collapsed;

            LoadingControl.IsLoading = true;

            try
            {
                Cancellation = new CancellationTokenSource();

                if (WeakToFileControl.TryGetTarget(out FileControl Control))
                {
                    string CurrentPath  = Control.CurrentPresenter.CurrentFolder.Path;
                    string SearchTarget = Control.GlobeSearch.Text;

                    List <FileSystemStorageItemBase> SearchItems = null;

                    switch (Category)
                    {
                    case SearchCategory.BuiltInEngine_Deep:
                    {
                        SearchItems = await Task.Run(() => WIN_Native_API.Search(CurrentPath, SearchTarget, true, SettingControl.IsDisplayHiddenItem, IncludeRegex, IngoreCase, Cancellation.Token)).ConfigureAwait(true);

                        break;
                    }

                    case SearchCategory.BuiltInEngine_Shallow:
                    {
                        SearchItems = await Task.Run(() => WIN_Native_API.Search(CurrentPath, SearchTarget, false, SettingControl.IsDisplayHiddenItem, IncludeRegex, IngoreCase, Cancellation.Token)).ConfigureAwait(true);

                        break;
                    }

                    case SearchCategory.EverythingEngine:
                    {
                        using (FullTrustProcessController.ExclusiveUsage Exclusive = await FullTrustProcessController.GetAvailableController())
                        {
                            SearchItems = await Exclusive.Controller.SearchByEverythingAsync(GlobleSearch?string.Empty : CurrentPath, SearchTarget, IncludeRegex, IngoreCase, MaxCount).ConfigureAwait(true);
                        }
                        break;
                    }
                    }

                    await Task.Delay(500).ConfigureAwait(true);

                    LoadingControl.IsLoading = false;

                    await Task.Delay(300).ConfigureAwait(true);

                    if (Cancellation.IsCancellationRequested)
                    {
                        HasItem.Visibility          = Visibility.Visible;
                        SearchResultList.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        if (SearchItems.Count == 0)
                        {
                            HasItem.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            foreach (FileSystemStorageItemBase Item in SortCollectionGenerator.Current.GetSortedCollection(SearchItems))
                            {
                                SearchResult.Add(Item);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracer.Log(ex, $"An error was threw in {nameof(Initialize)}");
            }
            finally
            {
                Cancellation.Dispose();
                Cancellation = null;
            }
        }
Esempio n. 37
0
 public SearchResult(SearchCategory category, IEnumerable <SearchItemViewModel> items)
 {
     Category = category;
     Items    = items;
 }
Esempio n. 38
0
        /// <summary>
        /// Presents the function name dialogue. Returns true if the user enters
        /// a function name and category.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="category"></param>
        /// <returns></returns>
        public void ShowNewFunctionDialog(FunctionNamePromptEventArgs e)
        {
            string error = "";

            do
            {
                var categorized =
                    SearchCategory.CategorizeSearchEntries(
                        dynamoViewModel.Model.SearchModel.SearchEntries,
                        entry => entry.Categories);

                var allCategories =
                    categorized.SubCategories.SelectMany(sub => sub.GetAllCategoryNames());

                var dialog = new FunctionNamePrompt(allCategories)
                {
                    categoryBox      = { Text = e.Category },
                    DescriptionInput = { Text = e.Description },
                    nameView         = { Text = e.Name },
                    nameBox          = { Text = e.Name },
                    // center the prompt
                    Owner = this,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                if (e.CanEditName)
                {
                    dialog.nameBox.Visibility  = Visibility.Visible;
                    dialog.nameView.Visibility = Visibility.Collapsed;
                }
                else
                {
                    dialog.nameView.Visibility = Visibility.Visible;
                    dialog.nameBox.Visibility  = Visibility.Collapsed;
                }

                if (dialog.ShowDialog() != true)
                {
                    e.Success = false;
                    return;
                }

                if (String.IsNullOrEmpty(dialog.Text))
                {
                    error = "You must supply a name.";
                    MessageBox.Show(error, "Custom Node Property Error", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
                //else if (e.Name != dialog.Text && dynamoViewModel.Model.BuiltInTypesByNickname.ContainsKey(dialog.Text))
                //{
                //    error = "A built-in node with the given name already exists.";
                //    MessageBox.Show(error, "Custom Node Property Error", MessageBoxButton.OK,
                //                                   MessageBoxImage.Error);
                //}
                else if (dialog.Category.Equals(""))
                {
                    error = "You must enter a new category or choose one from the existing categories.";
                    MessageBox.Show(error, "Custom Node Property Error", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
                else
                {
                    error = "";
                }

                e.Name        = dialog.Text;
                e.Category    = dialog.Category;
                e.Description = dialog.Description;
            } while (!error.Equals(""));

            e.Success = true;
        }
Esempio n. 39
0
 protected override bool ContinueProcessing(SearchCategory searchCategory)
 {
     return(searchCategory == SearchCategory.Account);
 }
 protected abstract bool ContinueProcessing(SearchCategory searchCategory);
Esempio n. 41
0
        public static async Task <List <MalClubEntry> > GetClubs(QueryType type, int page, SearchCategory category = SearchCategory.All,
                                                                 string searchQuery = null)
        {
            try
            {
                var client = await ResourceLocator.MalHttpContextProvider.GetHttpContextAsync();


                var response =
                    await client.GetAsync(
                        type == QueryType.All
                        ?$"/clubs.php?catid={(int) category}{(string.IsNullOrEmpty(searchQuery) || searchQuery.Length < 2 ? "" :$"&cn={searchQuery}&action=find")}&p={page}"
Esempio n. 42
0
        private void generateNewSearch()
        {
            //Settings.Default.ParticipantNumber = 9;
            //Settings.Default.Save();

            if (currIndex > maxIndex)
            {
                MessageBox.Show("Horray you're done!");
                file.Flush();
                Settings.Default.ParticipantNumber = Settings.Default.ParticipantNumber + 1;
                Settings.Default.Training = !Settings.Default.Training;
                Settings.Default.Save();
                file.Close();
                Environment.Exit(1);
            }

            int randomQuery = 0;
            List<string> currentCategory = new List<string>();
            InputDistortionSlider sliderToAccess; //will need to access some density information so I'll access a slider to do that. Since all sliders have the same distribution it doesn't matter which one I access
            List<uint> itemsPerIndex;
            int largestIndex;
            bool foundSatisfyingRandomNumber = false;
            double targetLowerBound = 0.0;
            double targetUpperBound = 1.0;
            int indexOfRandomNumber;

            currentSearchCategory = (SearchCategory)arrayDataSize1[currIndex];

            //decide if the query will be of actors, directors or actresses
            if (currentSearchCategory == SearchCategory.Actor)
            {
                currentCategory = movieHandler.UniqueActors;
                sliderToAccess = actorIDActiveAreaSlider;
            }
            else if (currentSearchCategory == SearchCategory.Actress)
            {
                currentCategory = movieHandler.UniqueActresses;
                sliderToAccess = actressIDActiveAreaSlider;
            }
            else
            {
                currentCategory = movieHandler.UniqueDirectors;
                sliderToAccess = directorIDActiveAreaSlider;
            }

            itemsPerIndex = sliderToAccess.ItemsInIndices;
            largestIndex = sliderToAccess.findLargestIndex();

            //find a satisfying person based on whether we want the target to be in a dense area, "sparse" area or somewhere in between
            while (!foundSatisfyingRandomNumber)
            {
                randomQuery = randomGenerator.Next(1, currentCategory.Count);

                if (arrayLocalDensity[currIndex] == 0)
                {
                    targetLowerBound = 0.0;
                    targetUpperBound = 1.0 / 3.0;
                    Debug.WriteLine("low density");
                }
                //else if (arrayDistortionType[currIndex] == 1)
                //{
                //    targetLowerBound = 1.0 / 3.0;
                //    targetUpperBound = 2.0 / 3.0;
                //}
                else if (arrayLocalDensity[currIndex] == 1)
                {
                    targetLowerBound = 2.0 / 3.0;
                    targetUpperBound = 1.0;
                    Debug.WriteLine("high density");
                }

                indexOfRandomNumber = findIndexOfNumber(randomQuery, itemsPerIndex);

                if (itemsPerIndex[indexOfRandomNumber] * 1.0 / itemsPerIndex[largestIndex] <= targetUpperBound && itemsPerIndex[indexOfRandomNumber] * 1.0 / itemsPerIndex[largestIndex] >= targetLowerBound)
                    foundSatisfyingRandomNumber = true;
            }

            //Generate search target
            //randomQuery = randomGenerator.Next(1, currentCategory.Count);
            searchTarget = currentCategory[randomQuery];
            searchLabel.Text = "the " + currentSearchCategory.ToString().ToLower() +" " + searchTarget;

            //change which slider is visible
            currSlider = arrayTechnique1[currIndex];

            changeVisibleSlider();
        }
Esempio n. 43
0
 public TripOptionModel()
 {
     this.SearchCategory = SearchCategory.Unspecified;
 }
Esempio n. 44
0
		void ShowResult (SearchCategory cat, ISearchDataSource result)
		{
			incompleteResults.Add (Tuple.Create (cat, result));

			incompleteResults.Sort ((x, y) => {
				return categories.IndexOf (x.Item1).CompareTo (categories.IndexOf (y.Item1));
			}
			);

			if (incompleteResults.Count == categories.Count) {
				results.Clear ();
				results.AddRange (incompleteResults);
				topItem = null;
				for (int i = 0; i < results.Count; i++) {
					if (results[i].Item2.ItemCount == 0)
						continue;
					if (topItem == null || topItem.DataSource.GetWeight (topItem.Item) <  results[i].Item2.GetWeight (0)) 
						topItem = new ItemIdentifier (results[i].Item1, results[i].Item2, 0);
				}
				selectedItem = topItem;

				ShowTooltip ();
				isInSearch = false;
				AnimatedResize ();
			}
		}
Esempio n. 45
0
 public void SetAsAddress(Address address)
 {
     SearchCategory = Enums.SearchCategory.Address;
     this.Address = address;
 }
Esempio n. 46
0
			public ItemIdentifier (SearchCategory category, IReadOnlyList<SearchResult> dataSource, int item)
			{
				this.Category = category;
				this.DataSource = dataSource;
				this.Item = item;
			}
Esempio n. 47
0
 public List <Problem> Search(string term, SearchCategory category)
 {
     return(search.SearchProblems(term, category));
 }
Esempio n. 48
0
        private void PopulateSearchCategories(IEnumerable<NodeSearchElement> nodes)
        {
            foreach (NodeSearchElement node in nodes)
            {
                var rootCategoryName = NodeSearchElement.SplitCategoryName(node.FullCategoryName).FirstOrDefault();

                var category = searchRootCategories.FirstOrDefault(sc => sc.Name == rootCategoryName);
                if (category == null)
                {
                    category = new SearchCategory(rootCategoryName);
                    searchRootCategories.Add(category);
                }

                var elementVM = MakeNodeSearchElementVM(node);
                elementVM.Category = GetCategoryViewModel(libraryRoot, node.Categories);

                category.AddMemberToGroup(elementVM);
            }

            // Update top result before we do not sort categories.
            if (searchRootCategories.Any())
                UpdateTopResult(searchRootCategories.FirstOrDefault().MemberGroups.FirstOrDefault());
            else
                UpdateTopResult(null);

            SortSearchCategoriesChildren();
        }
Esempio n. 49
0
 public async Task <List <Problem> > SearchAsync(string term, SearchCategory category)
 {
     return(await search.SearchProblemsAsync(term, category));
 }
			public ItemIdentifier (SearchCategory category, ISearchDataSource dataSource, int item)
			{
				this.Category = category;
				this.DataSource = dataSource;
				this.Item = item;
			}
Esempio n. 51
0
        /// <summary>
        /// Private method which exposes all possible parameters, with default values for the optional ones.
        /// </summary>
        /// <param name="category">Category=StockOption, IndexOption, FutureOption or CurrencyOption</param>
        /// <param name="symbolRoot">Symbol root. Required Field, the symbol the option is a derivative of, this search will not return options based on a partial root.</param>
        /// <param name="strikeCount">Number of strikes prices above and below the underlying price. Defaults to 3. Ignored if strike price high and low are passed.</param>
        /// <param name="strikePriceLow">Strike price low</param>
        /// <param name="strikePriceHigh">Strike price high</param>
        /// <param name="dateCount">Number of expiration dates. Default value 3. Ignored if expiration dates high and low are passed.</param>
        /// <param name="expirationDateLow">Expiration date low</param>
        /// <param name="expirationDateHigh">Expiration date high</param>
        /// <param name="optionType">Option type (Both, Call, Put) Default: Both</param>
        /// <param name="futureType">Future type (Electronic, Pit) Default: Electronic</param>
        /// <param name="symbolType">SymbolType (Both, Composite, Regional) Default: Composite</param>
        /// <param name="country">Country code (US, DE, CA) Default: US</param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        private List<Symbol> OptionSymbolSearch(SearchCategory category, string symbolRoot,
			uint strikeCount = 3, decimal strikePriceLow = 0, decimal strikePriceHigh = decimal.MaxValue,
			uint dateCount = 3, DateTime? expirationDateLow = null, DateTime? expirationDateHigh = null,
			OptionType optionType = OptionType.Both, FutureType futureType = FutureType.Electronic, SymbolType symbolType = SymbolType.Composite, CountryCode country = CountryCode.US,
			int timeout = TimeoutDefault)
        {
            //if (!IsAuthorized) throw new ClientAuthorizationException();
            if (strikePriceLow > 0 && strikePriceHigh == decimal.MaxValue) throw new ArgumentException("If strikePriceLow is passed a value must also be passed for strikePriceHigh.", "strikePriceHigh");
            if (expirationDateLow.HasValue || expirationDateHigh.HasValue)
            {
                if (!expirationDateLow.HasValue || !expirationDateHigh.HasValue) throw new ArgumentException("If a value is passed for expiration date high or low, the other value must also be passed.");
                if (expirationDateHigh <= expirationDateLow) throw new ArgumentOutOfRangeException("expirationDateHigh", "ExpirationHigh must be greater than ExpirationLow.");
            }

            Uri uri = new Uri(root, string.Format("/v2/data/symbols/search/{0}",
                SymbolSearch.GetOptionSearchCriteria(category, symbolRoot, strikeCount, strikePriceLow, strikePriceHigh, dateCount, expirationDateLow, expirationDateHigh, optionType, futureType, symbolType, country)));
            string response = TryGet(uri, timeout);
            List<Symbol> result = new List<Symbol>(255);
            List<Symbol> deserialized = JsonConvert.DeserializeObject<List<Symbol>>(response, new CountryCodeConverter());
            if (deserialized != null)
            {
                result = deserialized;
                result.Sort(new OptionComparer());
            }
            return result;
        }