getAutocompleteResults

fun getAutocompleteResults(    term: String,     facets: List<Pair<String, List<String>>>? = null,     groupId: Int? = null,     hiddenFields: List<String>? = null,     variationsMap: VariationsMap? = null,     sectionFacets: Map<String, List<Pair<String, List<String>>>>? = null): Observable<ConstructorData<AutocompleteResponse>>

Returns a list of autocomplete suggestions.

Example:

ConstructorIo.getAutocompleteResults("Dav", selectedFacet?.map { it.key to it.value })
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
it.onValue {
it?.let {
view.renderData(it)
}
}
}

Parameters

term

the term to search for

facets

additional facets used to refine results

groupId

category facet used to refine results

hiddenFields

show fields that are hidden by default

variationsMap

specify which attributes within variations should be returned

sectionFacets

specify sections for additional facets used to refine results


fun getAutocompleteResults(request: AutocompleteRequest): Observable<ConstructorData<AutocompleteResponse>>

Returns a list of autocomplete suggestions utilizing a request object.

Example

val filters = mapOf(
"group_id" to listOf("G1234"),
"Brand" to listOf("Cnstrc")
"Color" to listOf("Red", "Blue")
)
val request = AutocompleteRequest.Builder("Dav")
.setFilters(filters)
.setHiddenFields(listOf("hidden_field_1", "hidden_field_2"))
.build()

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

Parameters

request

the autocomplete request object