Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java |
— | — | @@ -903,7 +903,7 @@ |
904 | 904 | //XXX: should be redundant: just delete alias concepts below and then kill broken links. |
905 | 905 | // but somehow, we need it... |
906 | 906 | if (beginTask("finishAliases", "deleteLinksToBadConcepts:link,ALIAS")) { |
907 | | - int n = deleteLinksToBadConcepts(linkTable, "target", ConceptType.ALIAS); //uses index _use.concept, _concept.type |
| 907 | + int n = deleteLinksToBadConcepts(linkTable, "target", "target_anchor", ConceptType.ALIAS); //uses index _use.concept, _concept.type |
908 | 908 | if (n>0) warning(-1, "links to bad concepts", n+" references to redirects in "+linkTable.getName()+".target deleted", null); |
909 | 909 | endTask("finishAliases", "deleteLinksToBadConcepts:link,ALIAS", n+" entries"); |
910 | 910 | } |
— | — | @@ -1049,7 +1049,7 @@ |
1050 | 1050 | } |
1051 | 1051 | } |
1052 | 1052 | |
1053 | | - protected int deleteLinksToBadConcepts(DatabaseTable table, String conceptIdField, ConceptType... types) throws PersistenceException { |
| 1053 | + protected int deleteLinksToBadConcepts(DatabaseTable table, String conceptIdField, String index, ConceptType... types) throws PersistenceException { |
1054 | 1054 | ReferenceField refField = (ReferenceField)table.getField(conceptIdField); |
1055 | 1055 | DatabaseTable tgtTable = getTable(refField.getTargetTable()); |
1056 | 1056 | DatabaseField tgtField = tgtTable.getField(refField.getTargetField()); |
— | — | @@ -1061,11 +1061,12 @@ |
1062 | 1062 | String sql = "DELETE FROM "+table.getSQLName() |
1063 | 1063 | +" USING "+table.getSQLName() |
1064 | 1064 | +" JOIN "+conceptTable.getSQLName() |
| 1065 | + + ( index==null ? "" : "force index( "+index+" )" ) |
1065 | 1066 | +" ON "+table.getSQLName()+"."+conceptIdField+" = "+conceptTable.getSQLName()+"."+tgtField.getName(); |
1066 | 1067 | String where = " WHERE "+conceptTable.getSQLName()+".type IN " + bad; |
1067 | 1068 | |
1068 | 1069 | //System.out.println("*** "+sql+" ***"); |
1069 | | - return executeChunkedUpdate("deleteLinksToBadConcepts", table.getName()+"."+conceptIdField+" IN "+bad, sql, where, conceptTable, tgtField.getName()); |
| 1070 | + return executeChunkedUpdate("deleteLinksToBadConcepts", table.getName()+"."+conceptIdField+" IN "+bad, sql, where, table, conceptIdField); |
1070 | 1071 | } |
1071 | 1072 | |
1072 | 1073 | protected int deleteBrokenReferences(DatabaseTable table, String ref) throws PersistenceException { |