title: how to use spring boot to handle different search?
body: <p>What's the best practice to create search function in spring boot with spring data jpa?</p>
  
  <pre><code>@GetMapping("/search")
  public List&lt;Hotel&gt; getAllByCriteria(@RequestParam MultiValueMap&lt;String, String&gt; criteria) {
      if (criteria.containsKey("cityPublicId")) {
          String cityPublicId = criteria.getFirst("cityPublicId");
          if (criteria.containsKey("amenity")) { 
              List&lt;String&gt; amenities = criteria.get("amenity");
              return svc.findAllByCityAndAmenities(cityPublicId, amenities);
             }
          return svc.findAllByCity(cityPublicId);
      }
      //currently only support one amenity filtration
      else if (criteria.containsKey("amenity")) {
          return svc.findAllByAmenities(criteria.get("amenity"));
      }
      return null;
  }
  </code></pre>
  
  <p>Currently I have to identify all possible combination of criteria to use corresponding method, Is there a universal way to handle all condition? Or at least not hardcoding all possible combination. </p>
  
  <p>PS: If I want to filter result by multiple amenities, may I use findByAmenitiesContains(set)? Where a Hotel entity has a set of amenity. Do I have to create custom query using @query?</p>
  
  <p>Thanks.</p>