title: SwitchMap vs MergeMap in the #ngrx example
body: <p>Below is code from the Ngrx example: <a href="https://github.com/ngrx/example-app/blob/master/src/effects/book.ts" rel="noreferrer">https://github.com/ngrx/example-app/blob/master/src/effects/book.ts</a> My question is why in the first @Effect,  it uses <code>switchMap</code> while the others use <code>mergeMap</code>. Is that because the first @Effect is dealing with network, and with the <code>switchMap</code> you can cancel the previous network request if it's running?</p>
  
  <pre class="lang-js prettyprint-override"><code>@Effect() search$ = this.updates$
      .whenAction(BookActions.SEARCH)
      .map&lt;string&gt;(toPayload)
      .filter(query =&gt; query !== '')
      .switchMap(query =&gt; this.googleBooks.searchBooks(query)
        .map(books =&gt; this.bookActions.searchComplete(books))
        .catch(() =&gt; Observable.of(this.bookActions.searchComplete([])))
      );
  
  
    @Effect() clearSearch$ = this.updates$
      .whenAction(BookActions.SEARCH)
      .map&lt;string&gt;(toPayload)
      .filter(query =&gt; query === '')
      .mapTo(this.bookActions.searchComplete([]));
  
  
    @Effect() addBookToCollection$ = this.updates$
      .whenAction(BookActions.ADD_TO_COLLECTION)
      .map&lt;Book&gt;(toPayload)
      .mergeMap(book =&gt; this.db.insert('books', [ book ])
        .mapTo(this.bookActions.addToCollectionSuccess(book))
        .catch(() =&gt; Observable.of(
          this.bookActions.addToCollectionFail(book)
        ))
      );
  
  
    @Effect() removeBookFromCollection$ = this.updates$
      .whenAction(BookActions.REMOVE_FROM_COLLECTION)
      .map&lt;Book&gt;(toPayload)
      .mergeMap(book =&gt; this.db.executeWrite('books', 'delete', [ book.id ])
        .mapTo(this.bookActions.removeFromCollectionSuccess(book))
        .catch(() =&gt; Observable.of(
          this.bookActions.removeFromCollectionFail(book)
        ))
      );
  }
  </code></pre>