8484import at .kc .tugraz .ss .serv .serv .api .SSUserRelationGathererI ;
8585import at .kc .tugraz .ss .serv .serv .api .SSUsersResourcesGathererI ;
8686import at .kc .tugraz .ss .serv .serv .caller .SSServCallerU ;
87+ import at .kc .tugraz .ss .service .search .datatypes .SSSearchOpE ;
8788import at .kc .tugraz .ss .service .userevent .datatypes .SSUEE ;
8889import java .util .ArrayList ;
8990import java .util .List ;
@@ -574,10 +575,21 @@ public List<SSEntity> entitiesForLabelsAndDescriptionsGet(final SSServPar parA)
574575 try {
575576 final SSEntitiesForLabelsAndDescriptionsGetPar par = new SSEntitiesForLabelsAndDescriptionsGetPar (parA );
576577
577- return sqlFct .getEntitiesForLabelsAndDescriptions (
578- SSStrU .distinctWithoutEmptyAndNull (par .requireds ),
579- SSStrU .distinctWithoutEmptyAndNull (par .absents ),
580- SSStrU .distinctWithoutEmptyAndNull (par .eithers ));
578+ //TODO a lot of improvement and error handling here
579+
580+ if (!par .requireds .isEmpty ()){
581+ return sqlFct .getEntitiesForLabelsAndDescriptionsWithSQLLike (par .requireds , par .requireds , SSSearchOpE .and );
582+ }
583+
584+ if (!par .eithers .isEmpty ()){
585+ return sqlFct .getEntitiesForLabelsAndDescriptionsWithSQLLike (par .eithers , par .eithers , SSSearchOpE .or );
586+ }
587+
588+ if (!par .absents .isEmpty ()){
589+ throw new UnsupportedOperationException ("absents not suppported yet" );
590+ }
591+
592+ return new ArrayList <>();
581593
582594 }catch (Exception error ){
583595 SSServErrReg .regErrThrow (error );
@@ -591,10 +603,26 @@ public List<SSEntity> entitiesForLabelsGet(final SSServPar parA) throws Exceptio
591603 try {
592604 final SSEntitiesForLabelsGetPar par = new SSEntitiesForLabelsGetPar (parA );
593605
594- return sqlFct .getEntitiesForLabels (
595- SSStrU .distinctWithoutEmptyAndNull (par .requireds ),
596- SSStrU .distinctWithoutEmptyAndNull (par .absents ),
597- SSStrU .distinctWithoutEmptyAndNull (par .eithers ));
606+ //TODO a lot of improvment and error handling here
607+
608+ if (!par .requireds .isEmpty ()){
609+ return sqlFct .getEntitiesForLabelsAndDescriptionsWithSQLLike (par .requireds , new ArrayList <>(), SSSearchOpE .and );
610+ //TODO could also use public List<SSEntity> getEntitiesForLabelsAndDescriptions(final List<String> requireds,final List<String> absents,final List<String> eithers);
611+ //here, although it depends on the innodb_ft_min_token_size setting for InnoDB MYSQL tables then, and stopwords and so on
612+ //see http://dba.stackexchange.com/questions/51144/mysql-match-against-boolean-mode and http://dev.mysql.com/doc/refman/5.6/en/fulltext-stopwords.html
613+ //please consider that the actual version doesnt exploit MYSQL indexes on labels and descriptions
614+ }
615+
616+ if (!par .eithers .isEmpty ()){
617+ return sqlFct .getEntitiesForLabelsAndDescriptionsWithSQLLike (par .eithers , new ArrayList <>(), SSSearchOpE .or );
618+ }
619+
620+ if (!par .absents .isEmpty ()){
621+ throw new UnsupportedOperationException ("absents not suppported yet" );
622+ }
623+
624+ return new ArrayList <>();
625+
598626
599627 }catch (Exception error ){
600628 SSServErrReg .regErrThrow (error );
@@ -608,11 +636,21 @@ public List<SSEntity> entitiesForDescriptionsGet(final SSServPar parA) throws Ex
608636 try {
609637 final SSEntitiesForDescriptionsGetPar par = new SSEntitiesForDescriptionsGetPar (parA );
610638
611- return sqlFct .getEntitiesForDescriptions (
612- SSStrU .distinctWithoutEmptyAndNull (par .requireds ),
613- SSStrU .distinctWithoutEmptyAndNull (par .absents ),
614- SSStrU .distinctWithoutEmptyAndNull (par .eithers ));
639+ //TODO a lot of improvement and error handling here
640+
641+ if (!par .requireds .isEmpty ()){
642+ return sqlFct .getEntitiesForLabelsAndDescriptionsWithSQLLike (new ArrayList <>(), par .requireds , SSSearchOpE .and );
643+ }
644+
645+ if (!par .eithers .isEmpty ()){
646+ return sqlFct .getEntitiesForLabelsAndDescriptionsWithSQLLike (new ArrayList <>(), par .eithers , SSSearchOpE .or );
647+ }
648+
649+ if (!par .absents .isEmpty ()){
650+ throw new UnsupportedOperationException ("absents not suppported yet" );
651+ }
615652
653+ return new ArrayList <>();
616654 }catch (Exception error ){
617655 SSServErrReg .regErrThrow (error );
618656 return null ;
0 commit comments