Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Nov 21, 2023
1 parent dc6395c commit c9c9e70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
17 changes: 13 additions & 4 deletions doc/crud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,20 @@ Search, Order, and Pagination Options
->setSearchFields(null)
// call this method to focus the search input automatically when loading the 'index' page
->setAutofocusSearch()
// force to match all the terms (default mode)
// term1 in (field1 or field2) and term2 in (field1 or field2)

// by default, the search results match all the terms (SearchMode::ALL_TERMS):
// term1 in (field1 or field2) AND term2 in (field1 or field2)
// e.g. if you look for 'lorem ipsum' in [title, description],
// results require matching 'lorem' in either title or description
// (or both) AND 'ipsum' in either title or description (or both)
->setSearchMode(SearchMode::ALL_TERMS)
// match any terms
// term1 in (field1 or field2) or term2 in (field1 or field2)

// use the SearchMode::ANY_TERMS option to change the search mode to
// match at least one of the terms:
// term1 in (field1 or field2) OR term2 in (field1 or field2)
// e.g. if you look for 'lorem ipsum' in [title, description],
// results will match either 'lorem' in title or description (or both)
// OR 'ipsum' in title or description (or both)
->setSearchMode(SearchMode::ANY_TERMS)
;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Config/Option/SearchMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace EasyCorp\Bundle\EasyAdminBundle\Config\Option;

/**
* @author Roland Dufour (https://github.com/tasiot)
*/
final class SearchMode
{
public const ANY_TERMS = 'any_terms';
Expand Down

0 comments on commit c9c9e70

Please sign in to comment.