public static MtasSpanQuery constructQuery ( String queryValue , String queryType , String queryPrefix , HashMap < String , String [ ] > queryVariables , String field , String queryIgnore , Integer maximumIgnoreLength ) throws IOException { if ( queryType == null || queryType . isEmpty ( ) ) { throw new IOException ( "no (valid) type for query " + queryValue ) ; } else if ( queryValue == null || queryValue . isEmpty ( ) ) { throw new IOException ( "no (valid) value for " + queryType + " query" ) ; } MtasSpanQuery ignore = null ; if ( queryIgnore != null ) { Reader queryIgnoreReader = new BufferedReader ( new StringReader ( queryIgnore ) ) ; if ( queryType . equals ( QUERY_TYPE_CQL ) ) { MtasCQLParser ip = new MtasCQLParser ( queryIgnoreReader ) ; try { ignore = ip . parse ( field , null , null , null , null ) ; } catch ( mtas . parser . cql . ParseException e ) { throw new IOException ( "couldn't parse " + queryType + " query " + queryIgnore + " (" + e . getMessage ( ) + ")" , e ) ; } catch ( TokenMgrError e ) { throw new IOException ( "couldn't parse " + queryType + " query " + queryIgnore + " (" + e . getMessage ( ) + ")" , e ) ; } } else { throw new IOException ( "unknown queryType " + queryType + " for query " + queryValue ) ; } } Reader queryValueReader = new BufferedReader ( new StringReader ( queryValue ) ) ; if ( queryType . equals ( QUERY_TYPE_CQL ) ) { MtasCQLParser qp = new MtasCQLParser ( queryValueReader ) ; try { return qp . parse ( field , queryPrefix , queryVariables , ignore , maximumIgnoreLength ) ; } catch ( mtas . parser . cql . ParseException e ) { throw new IOException ( "couldn't parse " + queryType + " query " + queryValue + " (" + e . getMessage ( ) + ")" , e ) ; } catch ( TokenMgrError e ) { throw new IOException ( "couldn't parse " + queryType + " query " + queryValue + " (" + e . getMessage ( ) + ")" , e ) ; } } else { throw new IOException ( "unknown queryType " + queryType + " for query " + queryValue ) ; } }
Construct query .