Example #1
0
        public string GetBySearchParams(ISearchParams param)
        {
            var imgParam = (ImageSearchParams)param;

            var photoUrl = $"https://farm{imgParam.FarmId}.staticflickr.com/{imgParam.ServerId}/{imgParam.Id}_{imgParam.Secret}";

            //    var r = new BitMapImage(photoUrl);
            return(photoUrl);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var baseQuery = base.Export(searchParams);
            baseQuery.Add(new JProperty("query",
                new JObject(
                    new JProperty("match_none", null))));

            return baseQuery;
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);
            queryJson.Add(new JProperty("query", new JObject(
                new JProperty("boost", _boost),
                new JProperty("ids", new JArray(_docIds)))));

            return queryJson;
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);
            queryJson.Add(new JProperty("query", new JObject(
                new JProperty("boost", _boost),
                new JProperty("field", _field),
                new JProperty("regexp", _regex))));

            return queryJson;
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);

            queryJson.Add(new JProperty("query", new JObject(
                                            new JProperty("boost", _boost),
                                            new JArray("ids", _docIds))));

            return(queryJson);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var baseQuery = base.Export(searchParams);

            baseQuery.Add(new JProperty("query",
                                        new JObject(
                                            new JProperty("match_all", null))));

            return(baseQuery);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);
            queryJson.Add(new JProperty("query", new JObject(
                new JProperty("boost", _boost),
                new JProperty("field", _field),
                new JProperty("wildcard", _wildCard))));

            return queryJson;
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var baseQuery = base.Export(searchParams);
            baseQuery.Add(new JProperty("query",
                new JObject(
                    new JProperty("boost", _boost),
                    new JProperty("query", _query))));

            return baseQuery;
        }
Example #9
0
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);

            queryJson.Add(new JProperty("query", new JObject(
                                            new JProperty("boost", _boost),
                                            new JProperty("field", _field),
                                            new JProperty("regexp", _regex))));

            return(queryJson);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var baseQuery = base.Export(searchParams);

            baseQuery.Add(new JProperty("query",
                                        new JObject(
                                            new JProperty("boost", _boost),
                                            new JProperty("query", _query))));

            return(baseQuery);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);
            queryJson.Add(new JProperty("query", new JObject(
                new JProperty("match_phrase", _matchPhrase),
                new JProperty("boost", _boost),
                new JProperty("field", _field),
                new JProperty("analyzer", _analyzer))));

            return queryJson;
        }
Example #12
0
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);

            queryJson.Add(new JProperty("query", new JObject(
                                            new JProperty("match_phrase", _matchPhrase),
                                            new JProperty("boost", _boost),
                                            new JProperty("field", _field),
                                            new JProperty("analyzer", _analyzer))));

            return(queryJson);
        }
Example #13
0
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);
            queryJson.Add(new JProperty("query", new JObject(
                new JProperty("term", _term),
                new JProperty("boost", _boost),
                new JProperty("field", _field),
                new JProperty("prefix_length", _prefixLength),
                new JProperty("fuzziness", _fuzziness))));

            return queryJson;
        }
        public ISearchParams CreateParams(string apiType)
        {
            ISearchParams _parameter = null;

            if (apiType == "Flicker")
            {
            }
            else if (apiType == "Twitter")
            {
            }

            return(_parameter);
        }
Example #15
0
        public override JObject Export(ISearchParams searchParams)
        {
            var queryJson = base.Export(searchParams);

            queryJson.Add(new JProperty("query", new JObject(
                                            new JProperty("term", _term),
                                            new JProperty("boost", _boost),
                                            new JProperty("field", _field),
                                            new JProperty("prefix_length", _prefixLength),
                                            new JProperty("fuzziness", _fuzziness))));

            return(queryJson);
        }
Example #16
0
        public override JObject Export(ISearchParams searchParams)
        {
            if (!_queries.Any())
            {
                throw new InvalidOperationException("A ConjunctionQuery must have a least one child query!");
            }

            var baseQuery = base.Export(searchParams);

            baseQuery.Add(new JProperty("query",
                                        new JObject(
                                            new JProperty("boost", _boost),
                                            new JArray("conjuncts", _queries.Select(x => x.Export())))));

            return(baseQuery);
        }
Example #17
0
        public async Task <string> GetAll(ISearchParams param)
        {
            var imgParam = (ImageSearchParams)param;
            // For the Api Url written below, just get the new Api Url from the flickr api link the blog
            string provideUri = $"{BaseApiUrl}/?method=flickr.photos.getRecent&api_key={_apiKey}&license=10&sort=relevance&privacy_filter=1&safe_search=1&content_type=4&media=photos&tags={imgParam.SearchText}&&format=json&nojsoncallback=1";

            HttpClient client     = new HttpClient();
            string     jsonstring = await client.GetStringAsync(provideUri);

            /* var obj = JsonConvert.DeserializeObject<RootObject>(jsonstring);
             * if (obj.stat == "ok")
             * {
             *   FlickrGridView.ItemsSource = obj.photos.photo;
             * }*/
            return(jsonstring);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            if (!_shouldQueries.Any() && !_mustNotQueries.Any() && _mustQueries.Any())
            {
                throw new InvalidOperationException("A BooleanQuery must have a least one child query!");
            }

            var baseQuery = base.Export(searchParams);
            baseQuery.Add(new JProperty("query",
                new JObject(
                    new JProperty("boost", _boost),
                    new JArray("must", _mustQueries.Select(x => x.Export())),
                    new JArray("must_not", _mustQueries.Select(x => x.Export())),
                    new JArray("should", _mustQueries.Select(x => x.Export())))));

            return baseQuery;
        }
        public override JObject Export(ISearchParams searchParams)
        {
            if (!_shouldQueries.Any() && !_mustNotQueries.Any() && _mustQueries.Any())
            {
                throw new InvalidOperationException("A BooleanQuery must have a least one child query!");
            }

            var baseQuery = base.Export(searchParams);

            baseQuery.Add(new JProperty("query",
                                        new JObject(
                                            new JProperty("boost", _boost),
                                            new JArray("must", _mustQueries.Select(x => x.Export())),
                                            new JArray("must_not", _mustQueries.Select(x => x.Export())),
                                            new JArray("should", _mustQueries.Select(x => x.Export())))));

            return(baseQuery);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            if (_min == null && _max == null)
            {
                throw new InvalidOperationException("Either Min or Max can be omitted, but not both.");
            }

            var baseQuery = base.Export(searchParams);
            baseQuery.Add(new JProperty("query",
                new JObject(
                    new JProperty("boost", _boost),
                    new JProperty("field", _field),
                    new JProperty("min", _min),
                    new JProperty("inclusive_min", _minInclusive),
                    new JProperty("max", _max),
                    new JProperty("inclusive_max", _maxInclusive))));

            return baseQuery;
        }
Example #21
0
        public override JObject Export(ISearchParams searchParams)
        {
            if (_min == null && _max == null)
            {
                throw new InvalidOperationException("Either Min or Max can be omitted, but not both.");
            }

            var baseQuery = base.Export(searchParams);

            baseQuery.Add(new JProperty("query",
                                        new JObject(
                                            new JProperty("boost", _boost),
                                            new JProperty("field", _field),
                                            new JProperty("min", _min),
                                            new JProperty("inclusive_min", _minInclusive),
                                            new JProperty("max", _max),
                                            new JProperty("inclusive_max", _maxInclusive))));

            return(baseQuery);
        }
        public override JObject Export(ISearchParams searchParams)
        {
            if (_startTime == null && _endTime == null)
            {
                throw new InvalidOperationException("Either Start or End can be omitted, but not both.");
            }

            var baseQuery = base.Export(searchParams);
            baseQuery.Add(new JProperty("query",
                new JObject(
                    new JProperty("boost", _boost),
                    new JProperty("field", _field),
                    new JProperty("start", _startTime),
                    new JProperty("inclusive_start", _inclusiveStart),
                    new JProperty("end", _endTime),
                    new JProperty("inclusive_end", _inclusiveEnd),
                    new JProperty("datetime_parser", _parserName))));

            return baseQuery;
        }
        public override JObject Export(ISearchParams searchParams)
        {
            if (_startTime == null && _endTime == null)
            {
                throw new InvalidOperationException("Either Start or End can be omitted, but not both.");
            }

            var baseQuery = base.Export(searchParams);

            baseQuery.Add(new JProperty("query",
                                        new JObject(
                                            new JProperty("boost", _boost),
                                            new JProperty("field", _field),
                                            new JProperty("start", _startTime),
                                            new JProperty("inclusive_start", _inclusiveStart),
                                            new JProperty("end", _endTime),
                                            new JProperty("inclusive_end", _inclusiveEnd),
                                            new JProperty("datetime_parser", _parserName))));

            return(baseQuery);
        }
 /// <summary>
 /// Gets a JSON object representing this instance.
 /// </summary>
 /// <returns></returns>
 public virtual JObject Export(ISearchParams searchParams)
 {
     return searchParams.ToJson();
 }
Example #25
0
 /// <summary>
 /// Gets a JSON object representing this instance.
 /// </summary>
 /// <returns></returns>
 public virtual JObject Export(ISearchParams searchParams)
 {
     return(searchParams.ToJson());
 }
Example #26
0
 public string GetBySearchParams(ISearchParams param)
 {
     throw new NotImplementedException();
 }
Example #27
0
        public IQueryable <Note> Search(ISearchParams searchParams, ISortParams sortParams)
        {
            var query = _context.Notes.AsQueryable();

            if (searchParams.CourseId.HasValue)
            {
                query = query.Where(x => x.CourseId == searchParams.CourseId);
            }
            else if (searchParams.UniversityId.HasValue)
            {
                query = query.Where(x => x.Course.UniversityId == searchParams.UniversityId);
            }
            else if (searchParams.VoivodeshipId.HasValue)
            {
                query = query.Where(x => x.Course.University.VoivodeshipId == searchParams.VoivodeshipId);
            }

            if (!string.IsNullOrWhiteSpace(searchParams.NoteName))
            {
                query = query.Where(x => x.Name.Contains(searchParams.NoteName));
            }

            if (searchParams.Semester.HasValue)
            {
                query = query.Where(x => x.Semester == searchParams.Semester);
            }

            var sortColumn = new Func <Note, object>(x => x.Name);

            if (!string.IsNullOrWhiteSpace(sortParams.SortBy))
            {
                switch (sortParams.SortBy)
                {
                case "price":
                    sortColumn = x => x.Price;
                    break;

                case "name":
                    sortColumn = x => x.Name;
                    break;

                case "created":
                    sortColumn = x => x.CreatedAt;
                    break;

                case "updated":
                    sortColumn = x => x.ModifiedAt;
                    break;
                }
            }

            if (!string.IsNullOrEmpty(sortParams.SortOrder) && sortParams.SortOrder.ToUpper() == "DESC")
            {
                query = query.OrderByDescending(x => sortColumn(x));
            }
            else
            {
                query = query.OrderBy(x => sortColumn(x));
            }

            return(query);
        }
Example #28
0
 public async Task <string> GetAll(ISearchParams param)
 {
     throw new NotImplementedException();
 }
Example #29
0
 public static IList <INumberedFileInfo> SearchForFiles(ISearchParams sp, int?nbToKeep = null)
 {
     return(SearchForFiles(sp.Criterias.ToArray(), sp.SearchDirs.ToArray(), nbToKeep));
 }