/** * This is to ensure that we're dealing with field prefixes * * @param term this is the original term string * @param tokenType this is the default to use if no field prefix is present * @return a new {@link Term} */ protected Term getTerm(String term, TokenType tokenType) { // strip operators if (term.startsWith(OPERATOR_AND)) { term = term.substring(1); } String field = tokenType.name(); // default if (term.contains(FIELD_SEPARATOR)) { int pos = term.indexOf(FIELD_SEPARATOR); field = term.substring(0, pos); term = term.substring(pos + 1); } return new Term(field, term); }