public SongQueryParams() { Common = new CommonSearchParams(); IgnoredIds = new int[] {}; Paging = new PagingProperties(0, 30, true); SongTypes = new SongType[] {}; }
public AlbumQueryParams() { AlbumType = DiscType.Unknown; ArtistParticipationStatus = ArtistAlbumParticipationStatus.Everything; Common = new CommonSearchParams(); Paging = new PagingProperties(0, 30, true); }
public PartialFindResult <T> Find <T>(Func <Tag, T> fac, CommonSearchParams queryParams, PagingProperties paging, bool allowAliases = false, string categoryName = "") where T : class { var matchMode = queryParams.NameMatchMode; queryParams.Query = FindHelpers.GetMatchModeAndQueryForSearch(queryParams.Query ?? string.Empty, ref matchMode, NameMatchMode.Partial); queryParams.Query = queryParams.Query.Replace(' ', '_'); return(HandleQuery(ctx => { var query = ctx.Query() .WhereHasName(queryParams.Query, matchMode) .WhereAllowAliases(allowAliases) .WhereHasCategoryName(categoryName); var tags = query .OrderBy(t => t.Name) .Skip(paging.Start) .Take(paging.MaxEntries) .ToArray(); var count = 0; if (paging.GetTotalCount) { count = query.Count(); } var result = tags.Select(fac).ToArray(); return new PartialFindResult <T>(result, count, queryParams.Query, false); })); }
public PartialFindResult <T> Find <T>(Func <Tag, T> fac, CommonSearchParams queryParams, PagingProperties paging, bool allowAliases = false, string categoryName = "") where T : class { var textQuery = TagSearchTextQuery.Create(queryParams.Query, queryParams.NameMatchMode); return(HandleQuery(ctx => { var query = ctx.Query() .WhereHasName(textQuery) .WhereAllowAliases(allowAliases) .WhereHasCategoryName(categoryName); var tags = query .OrderBy(t => t.Name) .Skip(paging.Start) .Take(paging.MaxEntries) .ToArray(); var count = 0; if (paging.GetTotalCount) { count = query.Count(); } var result = tags.Select(fac).ToArray(); return new PartialFindResult <T>(result, count, queryParams.Query, false); })); }
public ArtistQueryParams() { Common = new CommonSearchParams(); Paging = new PagingProperties(0, 30, true); ArtistTypes = new ArtistType[] { }; }
public SongQueryParams() { Common = new CommonSearchParams(); IgnoredIds = new int[] {}; Paging = new PagingProperties(0, 30, true); SongTypes = new SongType[] {}; }
public AlbumQueryParams() { AlbumType = DiscType.Unknown; ArtistParticipationStatus = ArtistAlbumParticipationStatus.Everything; Common = new CommonSearchParams(); Paging = new PagingProperties(0, 30, true); }
public SongQueryParams() { ArtistParticipationStatus = ArtistAlbumParticipationStatus.Everything; Common = new CommonSearchParams(); IgnoredIds = new int[] {}; Paging = new PagingProperties(0, 30, true); SongTypes = new SongType[] {}; }
public AlbumQueryParams(SearchTextQuery textQuery, DiscType discType, int start, int maxResults, bool getTotalCount, AlbumSortRule sortRule = AlbumSortRule.Name, bool moveExactToTop = false) { Common = new CommonSearchParams(textQuery, false, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); AlbumType = discType; SortRule = sortRule; }
public AlbumQueryParams(string query, DiscType discType, int start, int maxResults, bool draftsOnly, bool getTotalCount, NameMatchMode nameMatchMode = NameMatchMode.Auto, AlbumSortRule sortRule = AlbumSortRule.Name, bool moveExactToTop = false) { Common = new CommonSearchParams(query, draftsOnly, nameMatchMode, false, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); AlbumType = discType; SortRule = sortRule; }
public SongQueryParams() { ArtistParticipationStatus = ArtistAlbumParticipationStatus.Everything; Common = new CommonSearchParams(); IgnoredIds = new int[] {}; Paging = new PagingProperties(0, 30, true); SongTypes = new SongType[] {}; }
/// <param name="query">Query search string. Can be null or empty, in which case no filtering by name is done.</param> /// <param name="songTypes">Allowed song types. Can be null or empy, in which case no filtering by song type is done.</param> /// <param name="start">0-based order number of the first item to be returned.</param> /// <param name="maxResults">Maximum number of results to be returned.</param> /// <param name="draftsOnly">Whether to return only entries with a draft status.</param> /// <param name="getTotalCount">Whether to return the total number of entries matching the criteria.</param> /// <param name="nameMatchMode">Mode for name maching. Ignored when query string is null or empty.</param> /// <param name="sortRule">Sort rule for results.</param> /// <param name="moveExactToTop">Whether to move exact match to the top of search results.</param> public ArtistQueryParams(string query, ArtistType[] songTypes, int start, int maxResults, bool draftsOnly, bool getTotalCount, NameMatchMode nameMatchMode, ArtistSortRule sortRule, bool moveExactToTop) { Common = new CommonSearchParams(query, draftsOnly, nameMatchMode, true, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); ArtistTypes = songTypes ?? new ArtistType[] { }; SortRule = sortRule; }
public AlbumQueryParams(string query, DiscType discType, int start, int maxResults, bool draftsOnly, bool getTotalCount, NameMatchMode nameMatchMode = NameMatchMode.Auto, AlbumSortRule sortRule = AlbumSortRule.Name, bool moveExactToTop = false) { Common = new CommonSearchParams(query, draftsOnly, nameMatchMode, false, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); AlbumType = discType; SortRule = sortRule; }
/// <param name="query">Query search string. Can be null or empty, in which case no filtering by name is done.</param> /// <param name="songTypes">Allowed song types. Can be null or empy, in which case no filtering by song type is done.</param> /// <param name="start">0-based order number of the first item to be returned.</param> /// <param name="maxResults">Maximum number of results to be returned.</param> /// <param name="draftsOnly">Whether to return only entries with a draft status.</param> /// <param name="getTotalCount">Whether to return the total number of entries matching the criteria.</param> /// <param name="nameMatchMode">Mode for name maching. Ignored when query string is null or empty.</param> /// <param name="sortRule">Sort rule for results.</param> /// <param name="moveExactToTop">Whether to move exact match to the top of search results.</param> public ArtistQueryParams(string query, ArtistType[] songTypes, int start, int maxResults, bool draftsOnly, bool getTotalCount, NameMatchMode nameMatchMode, ArtistSortRule sortRule, bool moveExactToTop) { Common = new CommonSearchParams(query, draftsOnly, nameMatchMode, true, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); ArtistTypes = songTypes ?? new ArtistType[] { }; SortRule = sortRule; }
/// <param name="query">Query search string. Can be null or empty, in which case no filtering by name is done.</param> /// <param name="songTypes">Allowed song types. Can be null or empy, in which case no filtering by song type is done.</param> /// <param name="start">0-based order number of the first item to be returned.</param> /// <param name="maxResults">Maximum number of results to be returned.</param> /// <param name="getTotalCount">Whether to return the total number of entries matching the criteria.</param> /// <param name="nameMatchMode">Mode for name maching. Ignored when query string is null or empty.</param> /// <param name="sortRule">Sort rule for results.</param> /// <param name="moveExactToTop">Whether to move exact match to the top of search results.</param> public ArtistQueryParams(ArtistSearchTextQuery textQuery, ArtistType[] songTypes, int start, int maxResults, bool getTotalCount, ArtistSortRule sortRule, bool moveExactToTop) { Common = CommonSearchParams.Create(textQuery, true, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); ArtistTypes = songTypes ?? new ArtistType[] { }; SortRule = sortRule; }
/// <param name="query">Query search string. Can be null or empty, in which case no filtering by name is done.</param> /// <param name="songTypes">Allowed song types. Can be null or empy, in which case no filtering by song type is done.</param> /// <param name="start">0-based order number of the first item to be returned.</param> /// <param name="maxResults">Maximum number of results to be returned.</param> /// <param name="draftsOnly">Whether to return only entries with a draft status.</param> /// <param name="getTotalCount">Whether to return the total number of entries matching the criteria.</param> /// <param name="nameMatchMode">Mode for name maching. Ignored when query string is null or empty.</param> /// <param name="sortRule">Sort rule for results.</param> /// <param name="onlyByName">Whether to search items only by name, and not for example NicoId. Ignored when query string is null or empty.</param> /// <param name="moveExactToTop">Whether to move exact match to the top of search results.</param> /// <param name="ignoredIds">List of entries to be ignored. Can be null in which case no filtering is done.</param> public SongQueryParams(string query, SongType[] songTypes, int start, int maxResults, bool draftsOnly, bool getTotalCount, NameMatchMode nameMatchMode, SongSortRule sortRule, bool onlyByName, bool moveExactToTop, int[] ignoredIds) { Common = new CommonSearchParams(query, draftsOnly, nameMatchMode, onlyByName, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); SongTypes = songTypes; SortRule = sortRule; IgnoredIds = ignoredIds; TimeFilter = TimeSpan.Zero; OnlyWithPVs = false; }
/// <param name="query">Query search string. Can be null or empty, in which case no filtering by name is done.</param> /// <param name="songTypes">Allowed song types. Can be null or empy, in which case no filtering by song type is done.</param> /// <param name="start">0-based order number of the first item to be returned.</param> /// <param name="maxResults">Maximum number of results to be returned.</param> /// <param name="getTotalCount">Whether to return the total number of entries matching the criteria.</param> /// <param name="nameMatchMode">Mode for name maching. Ignored when query string is null or empty.</param> /// <param name="sortRule">Sort rule for results.</param> /// <param name="onlyByName">Whether to search items only by name, and not for example NicoId. Ignored when query string is null or empty.</param> /// <param name="moveExactToTop">Whether to move exact match to the top of search results.</param> /// <param name="ignoredIds">List of entries to be ignored. Can be null in which case no filtering is done.</param> public SongQueryParams(SearchTextQuery textQuery, SongType[] songTypes, int start, int maxResults, bool getTotalCount, SongSortRule sortRule, bool onlyByName, bool moveExactToTop, int[] ignoredIds) { Common = new CommonSearchParams(textQuery, onlyByName, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); SongTypes = songTypes; SortRule = sortRule; IgnoredIds = ignoredIds; TimeFilter = TimeSpan.Zero; OnlyWithPVs = false; }
/// <param name="query">Query search string. Can be null or empty, in which case no filtering by name is done.</param> /// <param name="songTypes">Allowed song types. Can be null or empy, in which case no filtering by song type is done.</param> /// <param name="start">0-based order number of the first item to be returned.</param> /// <param name="maxResults">Maximum number of results to be returned.</param> /// <param name="draftsOnly">Whether to return only entries with a draft status.</param> /// <param name="getTotalCount">Whether to return the total number of entries matching the criteria.</param> /// <param name="nameMatchMode">Mode for name maching. Ignored when query string is null or empty.</param> /// <param name="sortRule">Sort rule for results.</param> /// <param name="onlyByName">Whether to search items only by name, and not for example NicoId. Ignored when query string is null or empty.</param> /// <param name="moveExactToTop">Whether to move exact match to the top of search results.</param> /// <param name="ignoredIds">List of entries to be ignored. Can be null in which case no filtering is done.</param> public SongQueryParams(string query, SongType[] songTypes, int start, int maxResults, bool draftsOnly, bool getTotalCount, NameMatchMode nameMatchMode, SongSortRule sortRule, bool onlyByName, bool moveExactToTop, int[] ignoredIds) { Common = new CommonSearchParams(query, draftsOnly, nameMatchMode, onlyByName, moveExactToTop); Paging = new PagingProperties(start, maxResults, getTotalCount); ArtistParticipationStatus = ArtistAlbumParticipationStatus.Everything; SongTypes = songTypes; SortRule = sortRule; IgnoredIds = ignoredIds; TimeFilter = TimeSpan.Zero; OnlyWithPVs = false; }
public PartialFindResult <TagForApiContract> GetList( string query = "", bool allowAliases = false, string categoryName = "", int start = 0, int maxResults = defaultMax, bool getTotalCount = false, NameMatchMode nameMatchMode = NameMatchMode.Exact, TagOptionalFields fields = TagOptionalFields.None) { maxResults = Math.Min(maxResults, absoluteMax); var ssl = WebHelper.IsSSL(Request); var queryParams = new CommonSearchParams(TagSearchTextQuery.Create(query, nameMatchMode), false, false, false); var paging = new PagingProperties(start, maxResults, getTotalCount); var tags = queries.Find(t => new TagForApiContract(t, thumbPersister, ssl, fields), queryParams, paging, allowAliases, categoryName); return(tags); }
public ArtistQueryParams() { Common = new CommonSearchParams <ArtistSearchTextQuery>(); Paging = new PagingProperties(0, 30, true); ArtistTypes = new ArtistType[] { }; }
public AlbumQueryParams() { AlbumType = DiscType.Unknown; Common = new CommonSearchParams(); Paging = new PagingProperties(0, 30, true); }
public TagQueryParams(CommonSearchParams common, PagingProperties paging) { Common = common; Paging = paging; }
public AlbumQueryParams() { AlbumType = DiscType.Unknown; Common = new CommonSearchParams(); Paging = new PagingProperties(0, 30, true); }