private static MtasSpanQuery createSubQueryFromGroupHit ( List < String > [ ] subHit , boolean reverse , String field ) { MtasSpanQuery query = null ; if ( subHit != null && subHit . length > 0 ) { List < MtasSpanSequenceItem > items = new ArrayList <> ( ) ; List < String > subHitItem ; for ( int i = 0 ; i < subHit . length ; i ++ ) { MtasSpanQuery item = null ; if ( reverse ) { subHitItem = subHit [ ( subHit . length - i - 1 ) ] ; } else { subHitItem = subHit [ i ] ; } if ( subHitItem . isEmpty ( ) ) { item = new MtasSpanMatchAllQuery ( field ) ; } else if ( subHitItem . size ( ) == 1 ) { Term term = new Term ( field , subHitItem . get ( 0 ) ) ; item = new MtasSpanTermQuery ( term ) ; } else { MtasSpanQuery [ ] subList = new MtasSpanQuery [ subHitItem . size ( ) ] ; for ( int j = 0 ; j < subHitItem . size ( ) ; j ++ ) { Term term = new Term ( field , subHitItem . get ( j ) ) ; subList [ j ] = new MtasSpanTermQuery ( term ) ; } item = new MtasSpanAndQuery ( subList ) ; } items . add ( new MtasSpanSequenceItem ( item , false ) ) ; } query = new MtasSpanSequenceQuery ( items , null , null ) ; } return query ; }
Creates the sub query from group hit .