searchbox core
1.0.0
SearchBox는 Redis에 구축 된 가벼운 검색 프레임 워크입니다.

전체 문서, 예제, 운영 세부 정보 및 기타 정보는 Wiki를 참조하십시오.
< dependency >
< groupId >com.quebic.searchbox</ groupId >
< artifactId >searchbox-core</ artifactId >
< version >1.0.0-SNAPSHOT</ version >
</ dependency >
@ SpringBootApplication
@ EnableSearchBox
public class App
{
public static void main ( String [] args )
{
SpringApplication . run ( App . class , args );
}
} searchbox.appname = movies-search-app
searchbox.page.length = # Search result page size. Default value is 10
server.host = # Http server host. Default value is localhost
server.port = # Http server port. Default value is 1028
redis.host = # Redis server host. Default value is localhost
redis.port = # Redis server port. Default value is 6379
public class Movie {
@ Id
@ Index
private int id ;
@ Index
private String title ;
@ Index
private String director ;
private int duration ;
... @ RestController
@ RequestMapping ( "/movies" )
public class MovieController {
@ Autowired
private SearchBoxOperations searchBoxOperations ;
...
< T > void insert ( T object ) throws SearchBoxOperationsException
< T > void update ( T object ) throws SearchBoxOperationsException
< T > void save ( T object ) throws SearchBoxOperationsException< T > SearchResult < T > searchByField ( Class < T > cls , String field , Object searchValue , Page page ) throws SearchBoxOperationsException ;searchBoxOperations.searchByField(Movie.class, "id", id) 예제< T > SearchResult < T > searchByFieldPerfix ( Class < T > cls , String field , Object searchPrefix , Page page , boolean allWords ) throws SearchBoxOperationsException ;searchBoxOperations.searchByFieldPerfix(Movie.class, "title", "av") => [ "아바타", "어벤져 스", ...]< T > SearchResult < T > searchByFieldPattern ( Class < T > cls , String field , String pattern , Page page ) throws SearchBoxOperationsException ;searchBoxOperations.searchByFieldPattern(Movie.class, "title", "*nic") => [ "타이타닉", ...] < T > SearchResult < T > search ( Class < T > cls , Query query , Page page ) throws SearchBoxOperationsException ;searchBoxOperations.search(Movie.class, new Query(Criteria.where("id").is(7))) 예제 @ QueryController
public class QueryFunctions {
@ QueryFunction ( "query1" )
public QueryHolder query1 () throws Exception {
Criteria c = Criteria
. where ( "@parm_key" ). is ( "@parm_value" );
Query query = new Query ( c );
return new QueryHolder ( Movie . class , query );
}
...쿼리 컨텐츠는 런타임 값을 쿼리로 전달하기 위해 '@'접두사가있는 자리 표시자를 사용합니다. 예 : @parm_key, @parm_value
SearchBoxOperations를 사용하여 쿼리 션을 호출합니다.
< T > SearchResult < T > search ( String queryName , Map < String , Object > inputParms , Page page ) throws SearchBoxOperationsException ; String queryName = "query1" ;
Map < String , Object > parms = new HashMap <>();
parms . put ( "parm_key" , "title" );
parms . put ( "parm_value" , "Avatar" );
searchBoxOperations . search ( "query1" , parms );