Coder Social home page Coder Social logo

instantsearch-app's Introduction

React Instantsearch App for NBA Teams & Players

Index Selection

The goal of this application is to create a search experience where users can search for NBA teams and players separately. I used two different indices from the provided `basketball` data set, one for `nba-teams` and `nba-players`.

Keeping separate indices, as opposed to having records for both teams and players in the same index, allowed me to tailor each index's configuration to its specific content while maintaining a flattened data structure.

From an implementation perspective, I indexed the data using the Algolia JavaScript API (scripts to configure each index can be found in the algolia directory) and built the search UI with the React InstantSearch library, Redux for global state management, and AWS S3 for image hosting. I chose this approach to illustrate my proficiency with these tools.

Searchable Attributes

  • nba-teams: ["name"]
  • nba-players: ["unordered(name)"]

In an effort to have as few searchable attributes as possible, I only set the `name` property to be searchable on each index. On the `nba-players` index, I used `["unordered(name)"]` to equally weight a player's first and last name at query time.

Filtering data

  • nba-teams: ["location", "score"]
  • nba-players: ["team", "points"]

While I did not want to include these properties in searchableAttributes, I improved the search experience and let users fine-tune their query by including them in attributesForFaceting at indexing time. I chose not to use the filterOnly method because I needed to include counts of each facet value on the frontend with the `RefinementList` widget.

Custom Ranking

  • nba-teams: ["desc(score)"]
  • nba-players: ["desc(points)"]

By default, when there is a tie between records in terms of textual relevance, the Algolia engine will use the objectID in alphanumeric order. Since a tie in terms of textual relevance is a high probability on each index (players with same first/last name on different teams, teams with same name in different locations), I set the `customRanking` attribute on each index at indexing time. In doing so, I created a search experience where the players with the most points or the teams with the highest score appeared earlier, allowing more relevant results in this use case.

instantsearch-app's People

Contributors

nicholasbierman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.