public QueryRule createDisMaxQueryRuleForTerms ( List < String > queryTerms ) { List < QueryRule > rules = new ArrayList <> ( ) ; queryTerms . stream ( ) . filter ( StringUtils :: isNotEmpty ) . map ( this :: escapeCharsExcludingCaretChar ) . forEach ( query -> { rules . add ( new QueryRule ( AttributeMetadata . LABEL , Operator . FUZZY_MATCH , query ) ) ; rules . add ( new QueryRule ( AttributeMetadata . DESCRIPTION , Operator . FUZZY_MATCH , query ) ) ; } ) ; QueryRule finalDisMaxQuery = new QueryRule ( rules ) ; finalDisMaxQuery . setOperator ( Operator . DIS_MAX ) ; return finalDisMaxQuery ; }
Create disMaxJunc query rule based a list of queryTerm . All queryTerms are lower cased and stop words are removed