protected Query getSynonymQuery(String field, String termStr, boolean quoted) throws ParseException
   {
      List<BooleanClause> synonyms = new ArrayList<BooleanClause>();
      synonyms.add(new BooleanClause(getFieldQuery(field, termStr, quoted), BooleanClause.Occur.SHOULD));
      if (synonymProvider != null)
      {
         String[] terms = synonymProvider.getSynonyms(termStr);
         for (int i = 0; i < terms.length; i++)
         {
            synonyms.add(new BooleanClause(getFieldQuery(field, terms[i], quoted), BooleanClause.Occur.SHOULD));
         }
      }
      if (synonyms.size() == 1)
      {
         return synonyms.get(0).getQuery();
      }
      else
      {
         return getBooleanQuery(synonyms);
      }
   }
protected Query getSynonymQuery ( String field , String termStr , boolean quoted ) throws ParseException { List < BooleanClause > synonyms = new ArrayList < BooleanClause > ( ) ; synonyms . add ( new BooleanClause ( getFieldQuery ( field , termStr , quoted ) , BooleanClause . Occur . SHOULD ) ) ; if ( synonymProvider != null ) { String [ ] terms = synonymProvider . getSynonyms ( termStr ) ; for ( int i = 0 ; i < terms . length ; i ++ ) { synonyms . add ( new BooleanClause ( getFieldQuery ( field , terms [ i ] , quoted ) , BooleanClause . Occur . SHOULD ) ) ; } } if ( synonyms . size ( ) == 1 ) { return synonyms . get ( 0 ) . getQuery ( ) ; } else { return getBooleanQuery ( synonyms ) ; } }
Factory method for generating a synonym query.
Called when parser parses an input term token that has the synonym
prefix (~term) prepended.

@param field Name of the field query will use.
@param termStr Term token to use for building term for the query

@return Resulting {@link Query} built for the term
@exception ParseException throw in overridden method to disallow