API Reference / Android Widgets / refinementList
Apr. 24, 2019

refinementList

Widget signature
<com.algolia.instantsearch.ui.views.RefinementList
  android:id="@+id/refinements"
  algolia:attribute="string"

  <!-- Optional parameters -->
  algolia:limit="integer"
  algolia:operation="string"
  algolia:sortBy="string|Array<string>"
/>

About this widget

The refinementList widget is one of the most common widget you can find in a search UI. With this widget, the user can filter the dataset based on facets.

The widget only displays the most relevant facets for the current search context. The sort option only affects the facets that are returned by the engine, not which facets are returned.

Requirements

The attribute provided to the widget must be added in attributes for faceting, either on the dashboard or using attributesForFaceting with the API.

If you are using the searchable prop, you also need to make the attribute searchable using the dashboard or using the searchable modifier of attributesForFaceting with the API.

Examples

1
2
3
4
5
6
7
8
9
<com.algolia.instantsearch.views.RefinementList
  android:id="@+id/refinements"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  algolia:attribute="city"
  algolia:limit="10"
  algolia:operation="or"
  algolia:sortBy="['isRefined', 'count:desc']"
/>

Parameters

attribute
type: string
Required

The name of the attributesForFaceting which facets are displayed.

1
algolia:attribute="city"
operation
type: string ("and"|"or")
default: "or"

How to apply refinements.

  • "or": apply an OR between all selected values.
  • "and": apply an AND between all selected values.
1
algolia:operation="and"
sortBy
type: string|Array<string>
default: ["isRefined","count:desc","name:asc"]

How to sort refinements. Must be one or more of the following strings:

  • "count:asc"
  • "count:desc"
  • "name:asc"
  • "name:desc"
  • "isRefined"
1
algolia:sortBy="['isRefined', 'count:desc']"
limit
type: integer
default: 10

How many facet values to retrieve.

1
algolia:limit=5
variant
type: string

An identifier for the widget group this widget is part of. If specified, this widget is only linked to other widgets that have the same variant. See Multi-Index Searches.

1
algolia:variant="actors"

Did you find this page helpful?