Skip to content

Commit

Permalink
Merge pull request #117 from Alfresco/FacetSearchV2
Browse files Browse the repository at this point in the history
Facet Search Version2
  • Loading branch information
ankitgoyalgloballogic authored Dec 20, 2021
2 parents 996f63d + 18ce29c commit 3f5f12c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ extension SearchAPI {
scope: nil,
limits: nil,
highlight: nil,
ranges: nil)
ranges: nil,
facetFormat: "V2")
SearchAPI.search(queryBody: searchRequest,
completion: completion)
}
Expand Down Expand Up @@ -157,7 +158,6 @@ extension SearchAPI {
limits: nil,
highlight: nil,
ranges: nil)

SearchAPI.search(queryBody: searchRequest,
completion: completion)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,44 +128,45 @@ public class SearchComponentOptions: Codable {

// MARK: - Facet Fields
public class FacetFields: Codable {
var expanded: Bool? = false
var fields = [Fields]()
public var expanded: Bool? = false
public var fields = [Fields]()
}

public class Fields: Codable {
var field: String?
var mincount: Int?
var label: String?
public var field: String?
public var mincount: Int?
public var label: String?
}

// MARK: - Facet Queries
public class FacetQueries: Codable {
var label: String?
var pageSize: Int?
var expanded: Bool?
var mincount: Int?
var queries = [Queries]()
public var label: String?
public var pageSize: Int?
public var expanded: Bool?
public var mincount: Int?
public var queries = [Queries]()
}

public class Queries: Codable {
var query: String?
var label: String?
public var query: String?
public var label: String?
public var group: String?
}

// MARK: - Facet Intervals
public class FacetIntervals: Codable {
var intervals = [Intervals]()
public var intervals = [Intervals]()
}

public class Intervals: Codable {
var label: String?
var field: String?
var sets = [Sets]()
public var label: String?
public var field: String?
public var sets = [Sets]()
}

public class Sets: Codable {
var label: String?
var start: String?
var end: String?
var endInclusive: Bool? = false
public var label: String?
public var start: String?
public var end: String?
public var endInclusive: Bool? = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public struct SearchRequest: Codable {
public var facetQueries: [Queries]?
public var facetFields: Dictionary<String, [Fields]?>?
public var facetIntervals: Dictionary<String, [Intervals]?>?
public var facetFormat: String?

public init(query: RequestQuery, paging: RequestPagination?, include: RequestInclude?, includeRequest: Bool?, fields: RequestFields?, sort: RequestSortDefinition?, templates: RequestTemplates?, defaults: RequestDefaults?, localization: RequestLocalization?, filterQueries: RequestFilterQueries?, facetQueries: FacetQueries?, facetFields: FacetFields?, facetIntervals: FacetIntervals?, pivots: [RequestPivot]?, stats: [RequestStats]?, spellcheck: RequestSpellcheck?, scope: RequestScope?, limits: RequestLimits?, highlight: RequestHighlight?, ranges: [RequestRange]?) {
public init(query: RequestQuery, paging: RequestPagination?, include: RequestInclude?, includeRequest: Bool?, fields: RequestFields?, sort: RequestSortDefinition?, templates: RequestTemplates?, defaults: RequestDefaults?, localization: RequestLocalization?, filterQueries: RequestFilterQueries?, facetQueries: FacetQueries?, facetFields: FacetFields?, facetIntervals: FacetIntervals?, pivots: [RequestPivot]?, stats: [RequestStats]?, spellcheck: RequestSpellcheck?, scope: RequestScope?, limits: RequestLimits?, highlight: RequestHighlight?, ranges: [RequestRange]?, facetFormat: String? = nil) {
self.query = query
self.paging = paging
self.include = include
Expand All @@ -60,6 +61,7 @@ public struct SearchRequest: Codable {
self.facetIntervals = nil
if let facetIntervals = facetIntervals {
self.facetIntervals = ["intervals": facetIntervals.intervals]
self.facetFormat = facetFormat
}
}
}

0 comments on commit 3f5f12c

Please sign in to comment.