Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java |
— | — | @@ -451,8 +451,9 @@ |
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | | - protected int resolveRedirects(RelationTable aliasTable, DatabaseTable table, String relNameField, String relIdField, AliasScope scope, int chunkFactor) throws PersistenceException { |
| 455 | + protected int resolveRedirects(RelationTable aliasTable, DatabaseTable table, String relNameField, String relIdField, AliasScope scope, int chunkFactor, String forceIndex) throws PersistenceException { |
456 | 456 | if (relIdField==null && relNameField==null) throw new IllegalArgumentException("relNameFields and relIdField can't both be null"); |
| 457 | + if (forceIndex!=null && table.getKey(forceIndex)==null) throw new IllegalArgumentException("unknown key: "+forceIndex); |
457 | 458 | |
458 | 459 | DatabaseField nmField = relNameField ==null ? null : table.getField(relNameField); |
459 | 460 | DatabaseField idField = relIdField == null ? null : table.getField(relIdField); |
— | — | @@ -465,7 +466,10 @@ |
466 | 467 | |
467 | 468 | if (idTable!=null && nmTable!=null && !nmTable.equals(idTable)) throw new IllegalArgumentException(relNameField+" and "+relIdField+" in table "+table.getName()+" do not reference the same table: "+nmTable+" != "+idTable); |
468 | 469 | |
469 | | - String sql = "UPDATE "+table.getSQLName()+" as R JOIN "+aliasTable.getSQLName()+" as E " |
| 470 | + |
| 471 | + String sql = "UPDATE "+table.getSQLName()+" as R " |
| 472 | + + (forceIndex!=null ? " force index ("+forceIndex+") " : "") |
| 473 | + + " JOIN "+aliasTable.getSQLName()+" as E " |
470 | 474 | + ((idField!=null) ? " ON R."+relIdField+" = E.source " : " ON R."+relNameField+" = E.source_name ") |
471 | 475 | + " SET "; |
472 | 476 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java |
— | — | @@ -669,7 +669,7 @@ |
670 | 670 | //NOTE: need to resolve category-aliases here, so no concepts are generated for aliased categories! |
671 | 671 | //NOTE: bad category redirs have been droped in finishBadLinks |
672 | 672 | if (beginTask("finishMissingConcpets", "resolveRedirects:broader")) { |
673 | | - int n = resolveRedirects(aliasTable, broaderTable, "broad_name", idManager==null ? null : "broad", AliasScope.CATEGORY, 1); |
| 673 | + int n = resolveRedirects(aliasTable, broaderTable, "broad_name", idManager==null ? null : "broad", AliasScope.CATEGORY, 1, idManager==null ? "broad_name" : "broad_narrow"); |
674 | 674 | endTask("finishMissingConcpets", "resolveRedirects:broader", n+" entries"); |
675 | 675 | } |
676 | 676 | |
— | — | @@ -741,24 +741,24 @@ |
742 | 742 | if (beginTask("finishAliases", "resolveRedirects:link")) { |
743 | 743 | //XXX: SLOW! |
744 | 744 | //TODO: smaller chunks? chunk on target table, not alias table? force index? |
745 | | - int n = resolveRedirects(aliasTable, linkTable, "target_name", "target", AliasScope.REDIRECT, 8); |
| 745 | + int n = resolveRedirects(aliasTable, linkTable, "target_name", "target", AliasScope.REDIRECT, 8, null); |
746 | 746 | endTask("finishAliases", "resolveRedirects:link", n+" entries"); |
747 | 747 | } |
748 | 748 | |
749 | 749 | //NOTE: broader.broad_name already done in finishMissingConcepts for AliasScope.BROADER |
750 | 750 | |
751 | 751 | if (beginTask("finishAliases", "resolveRedirects:about")) { |
752 | | - int n = resolveRedirects(aliasTable, aboutTable, null, "concept", null, 1); |
| 752 | + int n = resolveRedirects(aliasTable, aboutTable, null, "concept", null, 1, null); |
753 | 753 | endTask("finishAliases", "resolveRedirects:about", n+" entries"); |
754 | 754 | } |
755 | 755 | |
756 | 756 | if (beginTask("finishAliases", "resolveRedirects:narrow")) { |
757 | | - int n = resolveRedirects(aliasTable, broaderTable, "narrow_name", "narrow", null, 1); |
| 757 | + int n = resolveRedirects(aliasTable, broaderTable, "narrow_name", "narrow", null, 1, null); |
758 | 758 | endTask("finishAliases", "resolveRedirects:narrow", n+" entries"); |
759 | 759 | } |
760 | 760 | |
761 | 761 | if (beginTask("finishAliases", "resolveRedirects:broad")) { |
762 | | - int n = resolveRedirects(aliasTable, broaderTable, "broad_name", "broad", null, 1); |
| 762 | + int n = resolveRedirects(aliasTable, broaderTable, "broad_name", "broad", null, 1, null); |
763 | 763 | endTask("finishAliases", "resolveRedirects:broad", n+" entries"); |
764 | 764 | } |
765 | 765 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabasePropertyStoreBuilder.java |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | if (beginTask("finishAliases", "resolveRedirects:property")) { |
116 | 116 | RelationTable aliasTable = (RelationTable)conceptStoreSchema.getTable("alias"); |
117 | 117 | |
118 | | - int n = resolveRedirects(aliasTable, propertyTable, "concept_name", "concept", AliasScope.REDIRECT, 3); |
| 118 | + int n = resolveRedirects(aliasTable, propertyTable, "concept_name", "concept", AliasScope.REDIRECT, 3, null); |
119 | 119 | endTask("finishAliases", "resolveRedirects:property", n+" entries"); |
120 | 120 | } |
121 | 121 | } |