/// <summary> /// Visit key value pairs that are greater than or equal to the specified key. Visitation will continue as long as /// the visitor <seealso cref="KeyValueVisitor.visit(ReadableBuffer, ReadableBuffer) returns true"/>. /// </summary> /// <returns> {@code true} if an exact match was found, meaning that the first visited key/value pair was a perfect /// match for the specified key. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public boolean scan(SearchKey search, KeyValueVisitor visitor) throws java.io.IOException public virtual bool Scan(SearchKey search, KeyValueVisitor visitor) { BigEndianByteArrayBuffer searchKey = newBuffer(_keySize); BigEndianByteArrayBuffer key = newBuffer(_keySize); BigEndianByteArrayBuffer value = newBuffer(_valueSize); search.SearchKeyConflict(searchKey); int page = FindPage(searchKey, _pageCatalogue); if (page < 0 || (page >= _pageCatalogue.Length / (_keySize * 2))) { return(false); } using (PageCursor cursor = _file.io(page, PF_SHARED_READ_LOCK)) { if (!cursor.Next()) { return(false); } // finds and reads the first key/value pair int offset = FindByteOffset(cursor, searchKey, key, value); try { return(Arrays.Equals(searchKey.Buffer, key.Buffer)); } finally { VisitKeyValuePairs(_file.pageSize(), cursor, offset, visitor, false, key, value); } } }
// moteda sprawdzajaca czy w podanym searchQuery ma zasosowanie filtr, jesli tak to podaje ktorego pola i wartosci filtr dotyczy public bool CheckStringForBeingApplied(string searchQuery, out string fieldName, out string value) { fieldName = ""; value = ""; if (!(searchQuery.Length > 0)) { return(false); } string[] words = searchQuery.Trim().Split(new char[] { ' ' }); foreach (string s in words) { if (s.Trim().ToUpper().StartsWith(SearchKey.ToUpper() + Delimiter)) { foreach (var prop in (typeof(T)).GetProperties()) { if (prop.Name == FieldName) { value = s.Trim().Remove(0, (SearchKey + Delimiter).Length); fieldName = FieldName; return(true); } } } } return(false); }
private string GetAllSql(string CompanyID) { DataSet ds = BLL.CompanyBLL.GetCacheFields(CompanyID, Common.Tools.CaseTableType); string rtn = ""; string fieldtype; foreach (DataRow dr in ds.Tables[0].Rows) { fieldtype = dr["FieldType"].ToString().ToLower(); if (fieldtype == "datetime" || fieldtype == "money") { continue; } if (SearchKey.Contains(",")) { string[] keys = SearchKey.Split(','); foreach (string key in keys) { if (key != "") { rtn += " OR " + dr["FieldName"].ToString() + " like N'%" + key + "%'"; } } } else { rtn += " OR " + dr["FieldName"].ToString() + " like N'%" + SearchKey + "%'"; } } return(rtn.Substring(3)); }
//public searchEkhanei() //{ //} public searchEkhanei(SearchKey ob) { searchOb = ob; string key = searchOb.searchQuery.Trim().Replace(' ', '-'); nextEkhaneiLink = "http://www.ekhanei.com/en/bangladesh/" + key + "/for-sale"; }
public override int GetHashCode() { var num = (SearchKey != null) ? SearchKey.GetHashCode() : 0; num = 29 * num + ((ValueColName != null) ? ValueColName.GetHashCode() : 0); return(29 * num + ((Formula != null) ? Formula.GetHashCode() : 0)); }
public static WordsResponse Create(SearchKey keys) { RJGuard.ForNull(() => keys); return(new WordsResponse( keys.Id, keys.Word)); }
//added by Yang Li /// <summary> /// 搜索符合查询条件的节点 /// </summary> /// <param name="treeViewDataContextDS"></param> private void SearchByQueryCondition(ObservableCollection <ZookeeperTreeNodeModel> treeViewDataContextDS) { string searchKey = string.Empty; if (!string.IsNullOrWhiteSpace(SearchKey)) { searchKey = SearchKey.Trim().ToLower(); } // 删除不符合查询条件的所有节点(【/zookeeper】节点以及它的后代节点除外) int treeCount = treeViewDataContextDS.Count; for (int j = (treeCount - 1); j > -1; --j) { ZookeeperTreeNodeModel rootNode = treeViewDataContextDS[j]; if (rootNode.DisplayName.Equals("zookeeper")) { continue; } // 判断没有后代的鼻祖节点是否符合查询条件。如果不符合,则删除该鼻祖节点;如果符合,则不删除该鼻祖节点,而是退出本次循环,进入下棵树的遍历。 if (rootNode.Childs.Count == 0) { if (!IsMatchedAncestorNode(rootNode, searchKey)) { TreeViewDataContext[0].Childs.Remove(rootNode); } continue; } SearchByQueryCondition(rootNode, searchKey); } }
public SearchControl(SearchKey ob) { searchObject = ob; bikroy = new searchBikroy(searchObject); ekhanei = new searchEkhanei(searchObject); //print(); }
public searchBikroy(SearchKey ob) { searchOb = ob; string key = searchOb.searchQuery.Trim().Replace(' ', '+'); nextBikroyLink = "http://bikroy.com/en/ads/ads-in-bangladesh?query=" + key; }
protected override void Execute(CodeActivityContext context) { service = new TwitterService(ConsumerKey.Get(context), ConsumerSecret.Get(context), AccessToken.Get(context), AccessSecret.Get(context)) { TraceEnabled = true }; var tweetsSearch = service.Search(new SearchOptions { Q = SearchKey.Get(context), Resulttype = TwitterSearchResultType.Recent, Count = Count.Get(context) }); List <TwitterStatus> resultList = new List <TwitterStatus>(tweetsSearch.Statuses); dtTweet.Columns.Add("Tweet Id"); dtTweet.Columns.Add("User Name"); dtTweet.Columns.Add("User Screen Name"); dtTweet.Columns.Add("Text"); dtTweet.Columns.Add("Created Date"); dtTweet.Columns.Add("Retweet Count"); dtTweet.Columns.Add("Favorite Count"); dtTweet.Columns.Add("Profile Image URL"); foreach (var tweet in tweetsSearch.Statuses) { //tweet.Id; //Id of the tweet //tweet.User.ScreenName; //Screen Name of the user //tweet.User.Name; //Name of the User //tweet.Text; // Trimmed Text of the tweet //tweet.FullText; // Full Text of the tweet //tweet.RetweetCount; //No of retweet on twitter //tweet.User.FavouritesCount; //No of Fav mark on twitter //tweet.User.ProfileImageUrl; //Profile Image of Tweet //tweet.CreatedDate; //For Tweet posted time //"https://twitter.com/intent/retweet?tweet_id=" + tweet.Id; //For Retweet //"https://twitter.com/intent/tweet?in_reply_to=" + tweet.Id; //For Reply //"https://twitter.com/intent/favorite?tweet_id=" + tweet.Id; //For Favorite //Above are the things we can also get using TweetSharp. dtTweet.Rows.Add( FetchUserDetails.Get(context) ? tweet.Id : 0L, FetchUserDetails.Get(context) ? tweet.User.Name : "", FetchUserDetails.Get(context) ? tweet.User.ScreenName : "", FetchFullText.Get(context) ? tweet.FullText : tweet.Text, tweet.CreatedDate, tweet.RetweetCount, tweet.FavoriteCount, FetchUserDetails.Get(context) ? tweet.User.ProfileImageUrl : "" ); } OutputResult.Set(context, dtTweet); }
public ActionResult SearchProduct(string NavCategory, string NavKey) { SearchKey sk = new SearchKey(); sk.Category = NavCategory; sk.Key = NavKey; ViewBag.Category = HttpContext.Application["CategoriesFetched"] as IEnumerable <SelectListItem>; return(View(sk)); }
private void ShallowSearch(string keyword, SearchCategory category, int primaryIndex, List <SearchKey> searchKeys) { if (category == SearchCategory.MainTag) { if ((' ' + m_pointOfInterest.tags.ToLower()).Contains(' ' + keyword + ';')) { AddAllKeys(primaryIndex, searchKeys); } } else { if (category == SearchCategory.Name && !m_names.Contains(keyword)) { return; } else if (category == SearchCategory.SubTag && !m_tags.Contains(' ' + keyword + ';')) { return; } string target = ""; string key = ""; for (int secondaryIndex = 0; secondaryIndex < places.Count; secondaryIndex++) { PlaceCollection place = places[secondaryIndex]; for (int tertiaryIndex = 0; tertiaryIndex < place.count; tertiaryIndex++) { Location location = place.GetLocation(tertiaryIndex); if (location.isHidden) { continue; } GetTargetAndKeyFromLocationByCategory(location, category, keyword, ref target, ref key); if (target.Contains(key)) { SearchKey item = StrengthenSearchKey(primaryIndex, secondaryIndex, tertiaryIndex, searchKeys); if (category == SearchCategory.Name) { char firstLetter = keyword.ToCharArray()[0]; List <char> characters = new List <char>(target.ToCharArray()); int index = characters.IndexOf(firstLetter) - 1; if (index > item.nearestPoint) { item.nearestPoint = index; } } } } } } }
public ActionResult GetProduct(SearchKey sk, string Category, string Key) { ProductModelManager pmM = new ProductModelManager(); List <ProductModel> lstPm = new List <ProductModel>(); if (!String.IsNullOrWhiteSpace(Key)) { lstPm = pmM.GetProductByKeyword(Key, Category); } return(Json(lstPm, JsonRequestBehavior.AllowGet)); }
public GroupValueSearchKey Copy() { var copyKey = new GroupValueSearchKey(); if (SearchKey != null) { copyKey.SearchKey = SearchKey.Copy(); } copyKey.Formula = Formula; copyKey.ValueColName = ValueColName; copyKey.ReusedKey = ReusedKey; return(copyKey); }
public async Task <IActionResult> GetCity([FromQuery] SearchKey searchKey, CancellationToken cancellationToken) { if (searchKey == null) { return(BadRequest()); } var result = !string.IsNullOrEmpty(searchKey.City) ? await _weatherService.GetByCity(searchKey.City, cancellationToken) : await _weatherService.GetByZipCide(searchKey.ZipCode, cancellationToken); return(Ok(result)); }
public override void OnInspectorGUI() { locScript = (LocalizedText)target; locScript.key = EditorGUILayout.TextField("Key", locScript.key as string); if (GUILayout.Button("Search Key", GUILayout.ExpandWidth(false))) { SearchKey editorWindow = EditorWindow.GetWindow <SearchKey>(); editorWindow.inst = locScript; editorWindow.languageListObj = locManagerObj.languageList; editorWindow.viewIndex = locManagerObj.currentLanguage; } }
private SearchKey StrengthenSearchKey(int primaryIndex, int secondaryIndex, int tertiaryIndex, List <SearchKey> searchKeys, int increment = 1) { SearchKey item = FindKey(primaryIndex, secondaryIndex, tertiaryIndex, searchKeys); if (item == null) { item = new SearchKey(primaryIndex, secondaryIndex, tertiaryIndex); searchKeys.Add(item); } item.strength += increment; return(item); }
public void WhenFetchDataThenOkReturned() { var searchKey = new SearchKey { City = "Leipzig" }; _weatherContrller .GetCity(searchKey, CancellationToken.None) .Result .Should() .BeOfType <OkObjectResult>(); }
public List <SearchProduct> GetSearchProduct(SearchKey key) { return(SqlHelper.Instance.Queryable <T_Product, T_Shop>((p, s) => (p.ShopId == s.ShopId)) .Select((p, s) => new SearchProduct { productId = p.Id, productImgUrl = p.ProductImgUrl, productName = p.ProductName, productUprice = p.ProductUprice, productHot = p.ProductHot, productCommentNum = p.ProductCommentNum, shopName = s.ShopName }).OrderBy(r => r.productHot).OrderBy(r => r.productUprice).ToList()); }
public IActionResult saveKey(SearchKey key, string userId) { if (string.IsNullOrEmpty(userId)) { userId = User.FindFirstValue(ClaimTypes.NameIdentifier); } int i = new DataManager(userId).SaveKey(key, userId); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }
private Location Internal_GetLocationFromSearch(int index, out PointOfInterest pointOfInterest) { pointOfInterest = null; if (index < 0 || searchKeys == null || searchKeys.Count == 0 || index >= searchKeys.Count) { return(null); } SearchKey searchItem = searchKeys[index]; if (pointsOfInterestGroup == null || pointsOfInterestGroup.Count == 0 || searchItem.poiIndex >= pointsOfInterestGroup.Count || searchItem.poiIndex < 0) { return(null); } PointOfInterestGroup pointOfInterestGroup = pointsOfInterestGroup[searchItem.poiIndex]; if (pointOfInterestGroup == null) { return(null); } pointOfInterest = pointOfInterestGroup.pointOfInterest; PlaceCollection placeCollection = pointOfInterestGroup.GetPlaceCollection(searchItem.placeIndex); Location location = null; if (placeCollection == null) { return(null); } int locationIndex = searchItem.locationIndex - 1; if (locationIndex == -1) { location = placeCollection.GetPlaceLocation(); } else { location = placeCollection.GetRoomLocation(locationIndex); } return(location); }
public async Task <HttpResponseMessage> Add(WordsRequest request) { var existingWordsEntity = await unitOfWork.SearchKeyRepository.GetAllWords(); var existingWords = existingWordsEntity.Select(x => x.Word); foreach (var item in request.Words) { if (!existingWords.Contains(item)) { var word = new SearchKey(item); await unitOfWork.SearchKeyRepository.InsertAsync(word); } } await unitOfWork.SaveChangesAsync(); return(new HttpResponseMessage(HttpStatusCode.OK)); }
/// <summary> /// Gestione chiavi /// </summary> /// <param name="oSchema"></param> /// <param name="oProp"></param> /// <param name="oAttrKey"></param> /// <returns></returns> private static Key fillKeyAttribute(ClassSchema oSchema, Property oProp, SearchKey oAttrKey) { Key oKey; if (!oSchema.Keys.TryGetValue(oAttrKey.KeyName, out oKey)) { //Crea le key oKey = new Key(oAttrKey.KeyName); oKey.HashCode = BdoHash.Instance.Hash(string.Concat(oSchema.OriginalType.FullName, @".BdoKeys.", oKey.Name)); if (oAttrKey is PrimaryKey) { //E' la Primary Key oSchema.PrimaryKey = oKey; } //Aggiunge ad elenco oSchema.Keys.Add(oAttrKey.KeyName, oKey); } else { //Controllo Anomalie //1) Nome chiave PK if (!(oAttrKey is PrimaryKey) && oKey.Name == ClassSchema.PRIMARY_KEY) { throw new TypeFactoryException("{0}.{1} - Il nome di chiave '{1}' e' riservato", oSchema.ClassName, oProp.Name, ClassSchema.PRIMARY_KEY); } } ////Chiave definita su proprieta' semplice //if (!(oProp is PropertySimple)) // throw new TypeFactoryException("{0}.{1} - E' ammesso definire una chiave su una proprieta' semplice (non mappata)", oSchema.ClassName, oProp.Name, ClassSchema.PRIMARY_KEY); //La property non puo' essere di tipo LoadOnAccess if (oProp.IsSqlSelectExcluded) { throw new TypeFactoryException(Resources.SchemaMessages.Prop_KeyNeedValueQuery, oSchema.ClassName, oProp.Name); } //Aggiunge property a key oKey.AddProperty(oProp); //Ritorna Key return(oKey); }
public Response SearchJobs([FromBody] SearchKey searchKey) { //retrieve jobs from the REST API var jobs = JobBusinessService.SearchJobs(searchKey); //check if jobs are there //send a response back to search jobs js page with correct status if (jobs == null) { return(new Response { Status = "invalid", Message = "invalid job JSON array" }); } searchKey.User.RecentSearches = UserBusinessService.UpdateRecentSearches(searchKey); //send Job object array to be displayed on js page load return(new Response { Status = "valid", Message = "jobs found.", Jobs = jobs, User = searchKey.User }); }
/* * Please view method description in JobBusinessInterface */ public async Task <List <Job> > SearchJobs(SearchKey searchKey) { HttpClient client = new HttpClient(); List <Job> jobList = new List <Job>(); string response = await client.GetStringAsync(URL + "?description=" + searchKey.Key); var data = JsonConvert.DeserializeObject <Job[]>(response); if (data != null) { foreach (var job in data) { Job tempJob = new Job(job.id, job.title, job.type, job.description, job.company, job.company_url, job.url, job.location, job.how_to_apply, job.company_logo, job.created_at); jobList.Add(tempJob); } } return(jobList); }
public Dictionary <string, object> GetInfo(SearchKey key, object value) { DirectorySearcher search = new DirectorySearcher(entry); search.PropertiesToLoad.Add("cn"); search.PropertiesToLoad.Add("mail"); search.Filter = string.Format("(&(anr={0})(objectCategory=person))", value); search.PageSize = 1000; Dictionary <string, object> obj = new Dictionary <string, object>(); SearchResult sr = search.FindOne(); foreach (string s in sr.GetDirectoryEntry().Properties.PropertyNames) { obj.Add(s, sr.GetDirectoryEntry().Properties[s].Value); } return(obj); }
public override void ExecuteFilter(ref IQueryable <T> query, ref string searchQuery) { string Field = ""; //string Value = ""; if (CheckStringForBeingApplied(searchQuery, out Field, out SearchValue)) { ParameterExpression parameter = Expression.Parameter(typeof(T), "x"); Expression property = Expression.Property(parameter, Field); Expression target = Expression.Constant(SearchValue /*.ToUpper()*/, typeof(string)); MethodInfo mi = typeof(string).GetMethod("Contains", new Type[] { typeof(string) }); Expression equalsMethod = Expression.Call(property, mi, target); Expression <Func <T, bool> > lambda = Expression.Lambda <Func <T, bool> >(equalsMethod, parameter); query = query.Where(lambda); Executed = true; int iStart = searchQuery.ToUpper().IndexOf(SearchKey.ToUpper() + Delimiter + SearchValue.ToUpper()); int iLen = (SearchKey + Delimiter + SearchValue).Length; searchQuery = searchQuery.Remove(iStart, iLen).Trim(); } }
public Response ClearRecentSearches([FromBody] User user) { if (user == null) { //send a response back to login page that user was not found return(new Response { Status = "invalid", Message = "No users found." }); } SearchKey key = new SearchKey(); key.User = user; key.DeleteRecentSearches = true; //check if user exists in the database user.RecentSearches = BusinessService.UpdateRecentSearches(key); return(new Response { Status = "valid", User = user }); }
//added by Yang Li private void DoSearch() { try { if (_zk == null) { this.AddLog(LogType.Info, "Search Operation: Please connect to Server firstly.", false); return; } this.DoRefresh1(); if (TreeViewDataContext == null || !TreeViewDataContext.Any()) { this.AddLog(LogType.Info, "Search Operation: No content can be searched.", false); return; } if (string.IsNullOrWhiteSpace(SearchKey)) { this.AddLog(LogType.Error, "Search Operation: Please enter Search Condition before clicking Search button.", false); return; } SearchKey = SearchKey.Trim().Replace("/", "/"); if (SearchKey.Equals("/")) { this.AddLog(LogType.Info, "Search Operation: Search successfully.", false); return; } SearchByQueryCondition(TreeViewDataContext[0].Childs); this.RaiseToolBarCanExecuteChanged(); this.AddLog(LogType.Info, "Search Operation: Search successfully.", false); } catch (Exception ex) { //this.AddLog(LogType.Fatal, ex.Message); this.AddLog(LogType.Fatal, string.Format("Search Operation failed. The error message is 【{0}】.", ex.Message)); } }
private string GetNameandTbKeySql(string CompanyID) { string rtn = ""; if (SearchKey.Contains(",")) { string[] keys = SearchKey.Split(','); foreach (string key in keys) { if (key != "") { rtn += " OR tbName like N'%" + key + "%' or tbKey like N'%" + key + "%'"; } } return(rtn.Substring(3)); } else { return(" tbName like N'%" + SearchKey + "%' or tbKey like N'%" + SearchKey + "%'"); } }