android-searchbox  v0.0.1
A multi-purpose search widget which works both with offline and online databases(Appbase or ElasticSearch cluster). The search widget contains multiple functionalities like Voice Search, Smart Search, Analytics, etc.
com.harsh.searchwidget.Builder.SearchProp Class Reference

Public Member Functions

 SearchProp (String componentId, ArrayList< String > dataField)
 
SearchProp setExtraFields (ArrayList< String > extraFields)
 
SearchProp setCategoryField (String categoryField)
 
SearchProp setInPlaceCategory (boolean inPlaceCategory)
 
SearchProp setDefaultValue (String defaultValue)
 
SearchProp setWeights (ArrayList< Integer > weights)
 
SearchProp setAutoSuggest (Boolean autoSuggest)
 
SearchProp setDefaultSuggestions (ArrayList< ClientSuggestionsModel > defaultSuggestions)
 
SearchProp setHighlight (Boolean highlight)
 
SearchProp setHighlightField (ArrayList< String > highlightField)
 
SearchProp setTopEntries (int topEntries)
 
SearchProp setQueryFormat (String queryFormat)
 
SearchProp setFuzziness (String fuzziness)
 
SearchProp setDebounce (int debounce)
 
SearchProp setAggregrationState (boolean isAggregration)
 
SearchProp setAggregationFields (ArrayList< String > aggregationFields)
 
SearchProp setAggregationName (String aggregationName)
 
SearchProp setHitsEnabled (boolean hitsEnabled)
 
SearchProp setSearchResultImage (boolean searchResultImageState)
 
SearchProp setRedirectIcon (boolean redirectIconState)
 
SearchPropModel build ()
 

Constructor & Destructor Documentation

◆ SearchProp()

com.harsh.searchwidget.Builder.SearchProp.SearchProp ( String  componentId,
ArrayList< String >  dataField 
)

Initialises SearchProp builder

Parameters
componentIdUnique identifier of the component
dataFieldData field(s) on which the search query will be applied to

Member Function Documentation

◆ build()

SearchPropModel com.harsh.searchwidget.Builder.SearchProp.build ( )

Compiles all the parameter into one SearchPropModel

Returns
Object of SearchPropModel

◆ setAggregationFields()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setAggregationFields ( ArrayList< String >  aggregationFields)

Sets the field on which aggregation needs to be run

Parameters
aggregationFieldsThe fields on which aggregation query will be made
Returns

◆ setAggregationName()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setAggregationName ( String  aggregationName)

Sets specific name for the given aggregation query. Default name is "unique-terms"

Parameters
aggregationNameName of the aggregation query
Returns

◆ setAggregrationState()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setAggregrationState ( boolean  isAggregration)

Sets the state of aggregation functionality

Parameters
isAggregrationWhether aggregation count should be done or not
Returns

◆ setAutoSuggest()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setAutoSuggest ( Boolean  autoSuggest)

Sets state of auto suggest functionality

Parameters
autoSuggestSets whether the autosuggest functionality should be enabled or disabled
Returns

◆ setCategoryField()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setCategoryField ( String  categoryField)

Sets category field parameter

Parameters
categoryFieldData field which has the category values mapped
Returns

◆ setDebounce()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setDebounce ( int  debounce)

Sets debounce for given query

Parameters
debouncesets the milliseconds to wait before executing the query. Defaults to 0, i.e. no debounce
Returns

◆ setDefaultSuggestions()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setDefaultSuggestions ( ArrayList< ClientSuggestionsModel defaultSuggestions)

Sets default suggestions for search bar

Parameters
defaultSuggestionsPreset search suggestions to be shown on focus when the search box does not have any search query text set. Default suggestions should be an array list of suggestion model class
Returns

◆ setDefaultValue()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setDefaultValue ( String  defaultValue)

Sets default value parameter

Parameters
defaultValueSets the initial search query text on mount & the category
Returns

◆ setExtraFields()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setExtraFields ( ArrayList< String >  extraFields)

Sets extra fields to be returned for every search result These fields are parsed from the JSON response returned for the given search query Mainly used for displaying complete information of a search result on click gesture

Parameters
extraFieldsList of extra fields to be retrieved
Returns

◆ setFuzziness()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setFuzziness ( String  fuzziness)

Sets fuzziness for given query

Parameters
fuzzinessSets a maximum edit distance on the search parameters, can be "0", "1", "2" or “AUTO”. Useful for showing the correct results for an incorrect search parameter by taking the fuzziness into account
Returns

◆ setHighlight()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setHighlight ( Boolean  highlight)

Sets state of highlight functionality

Parameters
highlightWhether highlighting should be enabled in the returned results
Returns

◆ setHighlightField()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setHighlightField ( ArrayList< String >  highlightField)

Sets the fields to be returned when highlighting is on

Parameters
highlightFieldWhen highlighting is enabled, this prop allows specifying the fields which should be returned with the matching highlights. When not specified, it defaults to applying highlights on the field(s) specified in the dataField prop
Returns

◆ setHitsEnabled()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setHitsEnabled ( boolean  hitsEnabled)

Sets state of hits functionality

Parameters
hitsEnabledWhether number of hits should be displayed for each search result
Returns

◆ setInPlaceCategory()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setInPlaceCategory ( boolean  inPlaceCategory)

Sets position of category text

  • true: Below the search result
  • false: As a separate result at the top
Parameters
inPlaceCategoryBoolean state for positioning category text
Returns

◆ setQueryFormat()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setQueryFormat ( String  queryFormat)

Sets the query format of the request

Parameters
queryFormatSets the query format, can be "or" or "and". Defaults to "and"
Returns

◆ setRedirectIcon()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setRedirectIcon ( boolean  redirectIconState)

Sets redirect icon at the end of every search result entry (Applicable only if the search result redirects to the actual product)

Parameters
redirectIconStateWhether to show redirect icon
Returns

◆ setSearchResultImage()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setSearchResultImage ( boolean  searchResultImageState)

Sets image or icon before the search results/suggestions

Parameters
searchResultImageStateWhether to show search icon/image before search results
Returns

◆ setTopEntries()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setTopEntries ( int  topEntries)

Sets category below the search results for given top entries

Parameters
topEntriesEntries from top for which category is to be displayed
Returns

◆ setWeights()

SearchProp com.harsh.searchwidget.Builder.SearchProp.setWeights ( ArrayList< Integer >  weights)

Sets weight array for data fields

Parameters
weightsSets the search weight for the database fields, useful when dataField is an Array of more than one field. A higher number implies a higher relevance weight for the corresponding field in the search results
Returns

The documentation for this class was generated from the following file: