public DatabaseContent search(String query) throws org.dbwiki.exception.WikiException {
DatabaseQuery keywords = new DatabaseQuery(query);
RDBMSDatabaseListing entries = content();
VectorDatabaseListing result = new VectorDatabaseListing();
if (keywords.size() > 0) {
String union = "SELECT '0' kwid, " + RelDataColEntry + ", COUNT(*) cnt FROM " + name() + RelationData + " WHERE UPPER(" + RelDataColValue + ") LIKE '%" + keywords.get(0).toUpperCase() + "%' GROUP BY kwid, " + RelDataColEntry;
for (int iKW = 1; iKW < keywords.size(); iKW++) {
union = union + " UNION SELECT '" + iKW + "' kwid, "+ RelDataColEntry + ", COUNT(*) FROM " + name() + RelationData + " WHERE UPPER(" + RelDataColValue + ") LIKE '%" + keywords.get(iKW).toUpperCase() + "%' GROUP BY kwid, " + RelDataColEntry;
}
String sql = "(SELECT " + RelDataColEntry + ", COUNT(kwid), SUM(cnt) FROM (" + union + ") AS u GROUP BY " + RelDataColEntry + " ORDER BY COUNT(kwid) DESC, SUM(cnt) DESC) ";
try {
Connection con = _connector.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
NodeIdentifier identifier = new NodeIdentifier(rs.getInt(RelDataColEntry));
result.add(entries.get(identifier));
}
rs.close();
stmt.close();
con.close();
} catch (java.sql.SQLException sqlException) {