title: RxJava call the network when database is empty
body: <p>I'm using RxJava, Room and Retrofit to accomplish Repository pattern in Android. Everything is working except this one thing. I have implemented <code>SearchView</code> for searching data. Now when search view text changes I call search method. here is how it looks like</p>
  
  <pre><code>mLocal.searchMovies(query) //returns Single
  mRemote.searchMovies(query) //returns Single
  
  public Single&lt;List&lt;MovieEntity&gt;&gt; search(String query) {
      return mLocal.searchMovies(query)
          .toMaybe()
          .switchIfEmpty(mRemote.searchMovies(query)
          .map(data -&gt; {
              mLocal.saveAll(data);
              return data;
          }));
  }
  </code></pre>
  
  <p><code>mLocal</code> queries the room database and <code>mRemote</code> calls retrofit to fetch data from REST API. The problem is, this only calls mLocal and when room returns empty row network call is not initiated. I have tried everything I possibly and read many articles but I cannot understand how to get it work.</p>
  
  <p>Each of mLocal and mRemote works fine. Only chaining them does not accomplish what I want.</p>