title: Search bar returns results for all columns
body: <p>There is a seach handler like this:</p>
  <pre><code>  searchHandler = event =&gt; {
      const { getCustomers } = this.props;
      getCustomers({
        name: event.target.value,
        surname: this.props.query.surname,
        city: this.props.query.city,
        nationality: this.props.query.nationality,
        pagination: {
          currentPage: this.props.query.pagination.currentPage,
          totalPages: this.props.query.pagination.totalPages,
        },
      });
    };
  </code></pre>
  <p>What it does is that it is situtated on top of a table and filters the table data based on <code>name</code>.</p>
  <p>As it can be seen <code>name: event.target.value</code> and the other ones take their value from query.</p>
  <p>My task is to make it perform the search for all filters.</p>
  <p>For example, in the old function, if somebody searches for &quot;Jack&quot; it would return all the rows containing &quot;Jack&quot; in <code>name</code> field.</p>
  <p>The new one should return also the rows which are containing &quot;Jack&quot; in surname, nationality and so on.</p>
  <p>My approach was to set all values to <code>event.target.value</code>:</p>
  <pre><code>  searchHandler = event =&gt; {
      const { getCustomers } = this.props;
      getCustomers({
        name: event.target.value,
        surname: event.target.value,
        city: event.target.value,
        nationality: event.target.value,
        pagination: {
          currentPage: this.props.query.pagination.currentPage,
          totalPages: this.props.query.pagination.totalPages,
        },
      });
    };
  </code></pre>
  <p>Unfortunately, it does not work.</p>
  <p>How can it be made to make the search for all fields?</p>
  <p><strong>UPDATE</strong>
  The query is build in redux-saga like this:</p>
  <pre><code>export function* getCustomers({ query }) {
    let urlQuery = '';
  
    if (query &amp;&amp; query.pagination.currentPage) {
      urlQuery += `&amp;page=${query.pagination.currentPage}`;
    }
  
    if (query &amp;&amp; query.name) {
      urlQuery += `&amp;name=${query.name}`;
    }
  
    if (query &amp;&amp; query.surname) {
      urlQuery += `&amp;surname=${query.surname}`;
    }
  
    if (query &amp;&amp; query.city) {
      urlQuery += `&amp;city=${query.city}`;
    }
  
    if (query &amp;&amp; query.nationality) {
      urlQuery += `&amp;nationality=${query.nationality}`;
    }
  
    try {
      const response = yield call(api.getCustomers, urlQuery);
      yield put(Creators.getCustomersSuccess(response.data));
    } catch (error) {
      yield put(Creators.getCustomersFailure(error));
    }
  }
  </code></pre>
  <p>The query is built with AND (&amp;) and I think it should use something like OR (|) but I don't know how to implement it.</p>
  <p>If I test it with my approach ( setting <code>event.target.value</code> for all) and I write &quot;t&quot; in the searchBar, the API call will look like this which for sure is not correct:</p>
  <p><code>http://localhost:5000/customers?&amp;page=1&amp;name=t&amp;surname=t&amp;city=t&amp;nationality=t</code></p>
  <p>On the back-end, in mongoDB, the search is done like this:</p>
  <pre><code>const aggregateOptions = [];
  
   // search by name
      if (req.query.name) {
        aggregateOptions.push({ $match: { name: { $regex: req.query.name, $options: 'i' } } });
      }
  
      // search by nationality
      if (req.query.nationality) {
        aggregateOptions.push({ $match: { nationality: req.query.nationality } });
      }
  </code></pre>