Skip to content

Instantly share code, notes, and snippets.

@scneptune
Last active November 9, 2017 01:42
Show Gist options
  • Save scneptune/1f534e41b14de7051148a3308c8c35b6 to your computer and use it in GitHub Desktop.
Save scneptune/1f534e41b14de7051148a3308c8c35b6 to your computer and use it in GitHub Desktop.
Discussion notes from 11-8 about moving off of algoliaSearchIndecies

Goals

Ticket Description This is the FE work to display the current search results using ES instead of Algolia.

  • This will be considered done when;
    • A user searches for an item anywhere in the app using global search and consistent results are displayed
    • Results are displayed in a component that matches production currently
    • Existing search attributes are returned as results

This is to replace the current paradigm of a user selecting a search result and that result being placed at the top of the feed, with a results page for every selection.

This will be considered done when:

  • A user searches for an item anywhere in the app using global search, selects a single result and is taken to a results page

  • A result could be for either a:

    • Show
    • Episode/Ancillary
    • Misc
    • Film
  • A user can close out of the results page and be returned to the feed

  • For shows and films the results page offers the same functionality as the show feed:

    • Export
    • Expanded Episodes
    • Move an Episode (Show & Misc result only)
    • Sync
  • For Episode/Ancillary results:

    • A user can expand to see entire show from an episode
    • A user can view the episode detail page by selecting the episode title on the results page
    • A user can view the show detail page by selecting the show title next to the episode title on the results page

URL RQs: Search results page Single search result (show or episode)

Overarching Goal: Move all Shows, Misc, Episodes, Film Algolia Indicies into Elastic Search and use local search results to power "feeds"

What do we need to know:

  • Do we setup anything for elastic search locally? (Does pilot documentation repo have more information)
  • How do we plan on connecting to search indicies on the front end (via RESTful endpoint? are we going to connect to AWS?)
  • How do we plan on connecting an elastic search result with a serialized search result?
  • Will Elastic Indices organized in the same fashion as our current Algolia Indices? (ie. VideoManagerShows etc. etc.)
  • How do ulitize the matchingEpisode/matchingShow/matchingFilm/matchingMisc to give you back a show within new results?
  • What are the routes that we need to setup for global search result feeds?
  • What if someone refreshes the browser or hits the back durring a global search result. (url structure would have to match our redux history states).

What do we already know:

  • We will be deprecating Algolia Search Indexing and there are cache implications for the data that is returned
  • We know that we are not caching serialized results on Elastic Search.

What is happening next?

  1. We are restructing how search results on feeds across the app
  2. User Notification Search will probably also follow the same pattern that is implemented within this feature.
  3. React Router routes is also on the horizon which will affect how search results will generate urls.

current_flow

WHAT'S CHANGING

========================================================

Populating the Global Search Box

  • elastic search query (filter by 5 for each category)
  • return results in each category
  • render into SearchResultsView/SearchResultsSection for each category

SQL index

  • each item in the elastic search results should have its own unique id.
  • fetch the current SQL index and serialize to json for that category to populate results below the selected result.
  • fetch the matched item by elastic search id, from our db and return serialized result(endpoint needed);
  • return to store.

Feeds

  • New component to store Global search results.
  • New component for Media Object results (episodes or individual Misc content), that would link back to a show version of that content.
  • We need to be able to add matched show content in the Global search results to the export flow.
  • We need to be able to add matched show content to sync content
  • if there is only one matched show content item in global search results, check that item automatically in the list.
  • We need to have matched media work in the new Global search results.

DATA CONTRACT

In presentationalState we manage globalSearchResults as an array, which is a combined total of the search results. we need to create specific globalSearchResult categories for each type of result. this will probably be an object. {show: [], film: [], misc: [], episode: []} we will update SearchResultsSection to read each key from the new data value in the reducer. we will make a request to the api which will use the unique elastic search id to a route like /search/?id=234234233423 which will return a serialized mediaItem in JSON api format eg.

  data: {
    id: 1323,
    type: "ShortFormEpisode",
    attributes: { .... etc. },
    relationships: { ...  etc. }
  },
  meta: {
    mediaCategory: 'show',
  }
}

implement redux undo https://redux.js.org/docs/recipes/ImplementingUndoHistory.html and https://github.com/omnidan/redux-undo

const globalSearchResultsState = { 
    globalSearchResult: {
      show: [ { elasticMediaSearchResult } ], 
      film: [ { elasticMediaSearchResult } ], 
      misc: [ { elasticMediaSearchResult } ], 
      episode: [ { elasticMediaSearchResult } ]
    }
    currentFeedResults: [ { id: 234234, type: 'show', attributes: {} } ],
    previousFeedResults: [ [ currentFeedResults ] , [ currentFeedResults] ] 
    feedType: 'show' / 'media_object' / 'film',
    globalSearchQuery: ''
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment