getSearchResults

fun getSearchResults(    term: String,     facets: List<Pair<String, List<String>>>? = null,     page: Int? = null,     perPage: Int? = null,     groupId: Int? = null,     sortBy: String? = null,     sortOrder: String? = null,     sectionName: String? = null,     hiddenFields: List<String>? = null,     hiddenFacets: List<String>? = null,     groupsSortBy: String? = null,     groupsSortOrder: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     fmtOptions: Map<String, Any>? = null): Observable<ConstructorData<SearchResponse>>

Returns a list of search results including filters, categories, sort options, etc.

Example:

ConstructorIo.getSearchResults("Dave's bread", selectedFacets?.map { it.key to it.value }, 1, 24)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe {
it.onValue {
it.response?.let {
view.renderData(it)
}
}
}

Parameters

term

the term to search for

facets

additional facets used to refine results

page

the page number of the results

perPage

The number of results per page to return

groupId

category facet used to refine results

sortBy

the sort method for results

sortOrder

the sort order for results

sectionName

the section the results will come from defaults to "Products"

hiddenFields

show fields that are hidden by default

hiddenFacets

show facets that are hidden by default

groupsSortBy

the sort method for groups

groupsSortOrder

the sort order for groups

variationsMap

specify which attributes within variations should be returned

preFilterExpression

faceting expression to scope results

fmtOptions

additional format options to pass


fun getSearchResults(request: SearchRequest): Observable<ConstructorData<SearchResponse>>

Returns a list of search results including filters, categories, sort options, etc. utilizing a request object.

Example:

val filters = mapOf(
"group_id" to listOf("G1234"),
"Brand" to listOf("Cnstrc")
"Color" to listOf("Red", "Blue")
)
val request = SearchRequest.Builder("Dav")
.setFilters(filters)
.setHiddenFacets(listOf("hidden_facet_1", "hidden_facet_2"))
.build()

ConstructorIo.getSearchResults(request)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
it.onValue {
it?.let {
view.renderData(it)
}
}
}

Parameters

request

the search request object