Calling the .tableExists() method in LuceneUtil throws an UnsupportedOperationException for MySQL and HSQL
if (directory.tableExists()) {
directory.delete();
}
It throws an error because MySQL and HSQL cannot detect whether or not a table exists.
The workaround is to not use this method and to manually create or delete the table.
See below for more information:
org.apache.lucene.store.jdbc.dialect.Dialect from compass.jar:
/**
- If the dialect support a special query to check if a table exists, the actual
- sql that is used to perform it. Defaults to throw an Unsupported excetion (see
- {@link #supportsTableExists()}
.
{ throw new UnsupportedOperationException("Not sql provided to define if a table exists"); }
*/
public String sqlTableExists(String catalog, String schemaName)