Skip to content

Commit

Permalink
Merge pull request #113 from Alfresco/SearchWithFacetFilters
Browse files Browse the repository at this point in the history
Search with Facet Parameters
  • Loading branch information
gl-lovekesh authored Dec 2, 2021
2 parents 33d9776 + 4b7ae63 commit d84e18e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion AlfrescoContent/AlfrescoContent.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.14'
s.tvos.deployment_target = '12.0'
s.swift_version = '5.0'
s.version = '0.2.5'
s.version = '0.2.6'
s.source = {:git => 'https://github.com/Alfresco/alfresco-ios-swift-api.git', :tag => 'content/'+s.version.to_s}
s.authors = {'Alfresco' => '[email protected]'}
s.license = {:type => 'Apache License Version 2.0', :file => 'AlfrescoContent/LICENSE.md'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SimpleSearchRequest {
let maxItems: Int
let searchInclude: [SearchInclude]
var filterQueries : [String]

public init(querry: String,
parentId: String?,
skipCount: Int,
Expand Down Expand Up @@ -59,9 +59,11 @@ extension SearchAPI {
"-QNAME:comment AND -PNAME:'0/wiki'")
}


public class func simpleSearch(searchRequest: SimpleSearchRequest,
completion: @escaping ((_ data: ResultSetPaging?,_ error: Error?) -> Void)) {
facetFields: FacetFields?,
facetQueries: FacetQueries?,
facetIntervals: FacetIntervals?,
completion: @escaping ((_ data: ResultSetPaging?,_ error: Error?) -> Void)) {
let querry = requestQuery(searchRequest.querry + "*")
let paginationRequest = requestPagination(maxItems: searchRequest.maxItems,
skipCount: searchRequest.skipCount)
Expand Down Expand Up @@ -108,9 +110,9 @@ extension SearchAPI {
defaults: defaults,
localization: nil,
filterQueries: filter,
facetQueries: nil,
facetFields: nil,
facetIntervals: nil,
facetQueries: facetQueries,
facetFields: facetFields,
facetIntervals: facetIntervals,
pivots: nil,
stats: nil,
spellcheck: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public class Queries: Codable {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public struct GenericBucketBucketInfo: Codable {
/** The start of range */
public var start: String?
/** Includes values greater or equal to \"start\" */
public var startInclusive: Bool?
public var startInclusive: String?
/** The end of range */
public var end: String?
/** Includes values less than or equal to \"end\" */
public var endInclusive: Bool?
public var endInclusive: String?

public init(start: String?, startInclusive: Bool?, end: String?, endInclusive: Bool?) {
public init(start: String?, startInclusive: String?, end: String?, endInclusive: String?) {
self.start = start
self.startInclusive = startInclusive
self.end = end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ public struct SearchRequest: Codable {
public var defaults: RequestDefaults?
public var localization: RequestLocalization?
public var filterQueries: RequestFilterQueries?
public var facetQueries: RequestFacetQueries?
public var facetFields: RequestFacetFields?
public var facetIntervals: RequestFacetIntervals?
public var pivots: [RequestPivot]?
public var stats: [RequestStats]?
public var spellcheck: RequestSpellcheck?
public var scope: RequestScope?
public var limits: RequestLimits?
public var highlight: RequestHighlight?
public var ranges: [RequestRange]?
public var facetQueries: [Queries]?
public var facetFields: Dictionary<String, [Fields]?>?
public var facetIntervals: Dictionary<String, [Intervals]?>?

public init(query: RequestQuery, paging: RequestPagination?, include: RequestInclude?, includeRequest: Bool?, fields: RequestFields?, sort: RequestSortDefinition?, templates: RequestTemplates?, defaults: RequestDefaults?, localization: RequestLocalization?, filterQueries: RequestFilterQueries?, facetQueries: RequestFacetQueries?, facetFields: RequestFacetFields?, facetIntervals: RequestFacetIntervals?, 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]?) {
self.query = query
self.paging = paging
self.include = include
Expand All @@ -44,18 +44,22 @@ public struct SearchRequest: Codable {
self.defaults = defaults
self.localization = localization
self.filterQueries = filterQueries
self.facetQueries = facetQueries
self.facetFields = facetFields
self.facetIntervals = facetIntervals
self.pivots = pivots
self.stats = stats
self.spellcheck = spellcheck
self.scope = scope
self.limits = limits
self.highlight = highlight
self.ranges = ranges

self.facetQueries = facetQueries?.queries
self.facetFields = nil
if let facetFields = facetFields {
self.facetFields = ["facets": facetFields.fields]
}
self.facetIntervals = nil
if let facetIntervals = facetIntervals {
self.facetIntervals = ["intervals": facetIntervals.intervals]
}
}


}

0 comments on commit d84e18e

Please sign in to comment.