Backend Development 8 min read

Bean Searcher: A High‑Performance Java Search Engine for Complex List Queries

Bean Searcher is an open‑source Java library that delivers a condition‑retrieval engine up to 100 times faster than MyBatis, natively supports multi‑table joins, pagination, sorting and aggregation, and enables developers to implement sophisticated list‑search APIs with a single line of code, dramatically reducing backend development effort.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Bean Searcher: A High‑Performance Java Search Engine for Complex List Queries

Bean Searcher is an open‑source Java library (Apache‑2.0 license) that provides a condition‑retrieval engine claimed to be up to 100 times faster than MyBatis, with built‑in support for multi‑table joins, pagination, arbitrary field sorting, and field aggregation, allowing complex list queries to be expressed in a single line of code.

Key Features include entity multi‑table mapping, dynamic field operators, group aggregation queries, sub‑queries (Select | Where | From), embedded parameters, field converters, SQL interceptors, extensible database dialects, multiple and dynamic data sources, default and custom annotations, and extensible field operators.

Quick Development : By defining a simple @SearchBean‑annotated entity and injecting BeanSearcher, a full‑featured search endpoint can be written in one line:

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private BeanSearcher beanSearcher;
    @GetMapping("/index")
    public SearchResult
index(HttpServletRequest request) {
        // only one line of code
        return beanSearcher.search(User.class, MapUtils.flat(request.getParameterMap()), new String[]{"age"});
    }
}

The entity definition example:

@SearchBean(tables="user u, role r", joinCond="u.role_id = r.id", autoMapTo="u")
public class User {
    private long id;
    private String username;
    private int status;
    private int age;
    private String gender;
    private Date joinDate;
    private int roleId;
    @DbField("r.name")
    private String roleName;
    // getters and setters ...
}

Additional code snippets illustrate the parameter builder, Spring Boot integration, and manual SearcherBuilder usage:

Map<String, Object> params = MapUtils.builder()
        .selectExclude(User::getJoinDate) // exclude joinDate
        .field(User::getStatus, 1) // status = 1
        .field(User::getName, "Jack").ic() // name = 'Jack' (case‑ignored)
        .field(User::getAge, 20, 30).op(Opetator.Between) // age between 20 and 30
        .orderBy(User::getAge, "asc") // order by age asc
        .page(0, 15) // page 0, 15 items per page
        .build();
List
users = beanSearcher.searchList(User.class, params);

Spring Boot integration requires only a single dependency:

implementation 'com.ejlchina:bean-searcher-boot-stater:3.6.0'

and the searcher can be injected as MapSearcher or BeanSearcher beans.

Extensibility : The library is interface‑driven, allowing developers to plug in custom FieldOp, FieldConvertor, DbMapping, ParamResolver, Dialect, and other components to adapt to specific database or ORM requirements.

The article also provides the project’s source code links (Gitee and GitHub) and concludes with promotional calls to join the author’s community.

Javasearch enginebackend developmentSpring BootORMBean Searcher
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.