Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java |
— | — | @@ -460,9 +460,10 @@ |
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
464 | | - protected int resolveRedirects(RelationTable aliasTable, DatabaseTable table, String relNameField, String relIdField, AliasScope scope, int chunkFactor, String forceIndex) throws PersistenceException { |
| 464 | + protected int resolveRedirects(RelationTable aliasTable, DatabaseTable table, String relNameField, String relIdField, AliasScope scope, int chunkFactor, String forceRIndex, String forceEIndex) throws PersistenceException { |
465 | 465 | if (relIdField==null && relNameField==null) throw new IllegalArgumentException("relNameFields and relIdField can't both be null"); |
466 | | - if (forceIndex!=null && table.getKey(forceIndex)==null) throw new IllegalArgumentException("unknown key: "+forceIndex); |
| 466 | + if (forceRIndex!=null && table.getKey(forceRIndex)==null) throw new IllegalArgumentException("unknown key: "+forceRIndex); |
| 467 | + if (forceEIndex!=null && aliasTable.getKey(forceEIndex)==null) throw new IllegalArgumentException("unknown key: "+forceEIndex); |
467 | 468 | |
468 | 469 | DatabaseField nmField = relNameField ==null ? null : table.getField(relNameField); |
469 | 470 | DatabaseField idField = relIdField == null ? null : table.getField(relIdField); |
— | — | @@ -477,8 +478,9 @@ |
478 | 479 | |
479 | 480 | |
480 | 481 | String sql = "UPDATE "+table.getSQLName()+" as R " |
481 | | - + (forceIndex!=null ? " force index ("+forceIndex+") " : "") |
| 482 | + + (forceRIndex!=null ? " force index ("+forceRIndex+") " : "") |
482 | 483 | + " JOIN "+aliasTable.getSQLName()+" as E " |
| 484 | + + (forceEIndex!=null ? " force index ("+forceEIndex+") " : "") |
483 | 485 | + ((idField!=null) ? " ON R."+relIdField+" = E.source " : " ON R."+relNameField+" = E.source_name ") |
484 | 486 | + " SET "; |
485 | 487 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java |
— | — | @@ -676,7 +676,7 @@ |
677 | 677 | //NOTE: need to resolve category-aliases here, so no concepts are generated for aliased categories! |
678 | 678 | //NOTE: bad category redirs have been droped in finishBadLinks |
679 | 679 | if (beginTask("finishMissingConcpets", "resolveRedirects:broader")) { |
680 | | - int n = resolveRedirects(aliasTable, broaderTable, "broad_name", idManager==null ? null : "broad", AliasScope.CATEGORY, 1, idManager==null ? "broad_name" : "broad_narrow"); |
| 680 | + int n = resolveRedirects(aliasTable, broaderTable, "broad_name", idManager==null ? null : "broad", AliasScope.CATEGORY, 1, idManager==null ? "broad_name" : "broad_narrow", null); |
681 | 681 | endTask("finishMissingConcpets", "resolveRedirects:broader", n+" entries"); |
682 | 682 | } |
683 | 683 | |
— | — | @@ -748,24 +748,24 @@ |
749 | 749 | if (beginTask("finishAliases", "resolveRedirects:link")) { |
750 | 750 | //XXX: SLOW! |
751 | 751 | //TODO: smaller chunks? chunk on target table, not alias table? force index? |
752 | | - int n = resolveRedirects(aliasTable, linkTable, "target_name", "target", AliasScope.REDIRECT, 8, null); |
| 752 | + int n = resolveRedirects(aliasTable, linkTable, "target_name", "target", AliasScope.REDIRECT, 8, null, "source"); |
753 | 753 | endTask("finishAliases", "resolveRedirects:link", n+" entries"); |
754 | 754 | } |
755 | 755 | |
756 | 756 | //NOTE: broader.broad_name already done in finishMissingConcepts for AliasScope.BROADER |
757 | 757 | |
758 | 758 | if (beginTask("finishAliases", "resolveRedirects:about")) { |
759 | | - int n = resolveRedirects(aliasTable, aboutTable, null, "concept", null, 1, null); |
| 759 | + int n = resolveRedirects(aliasTable, aboutTable, null, "concept", null, 1, null, null); |
760 | 760 | endTask("finishAliases", "resolveRedirects:about", n+" entries"); |
761 | 761 | } |
762 | 762 | |
763 | 763 | if (beginTask("finishAliases", "resolveRedirects:narrow")) { |
764 | | - int n = resolveRedirects(aliasTable, broaderTable, "narrow_name", "narrow", null, 1, null); |
| 764 | + int n = resolveRedirects(aliasTable, broaderTable, "narrow_name", "narrow", null, 1, null, null); |
765 | 765 | endTask("finishAliases", "resolveRedirects:narrow", n+" entries"); |
766 | 766 | } |
767 | 767 | |
768 | 768 | if (beginTask("finishAliases", "resolveRedirects:broad")) { |
769 | | - int n = resolveRedirects(aliasTable, broaderTable, "broad_name", "broad", null, 1, null); |
| 769 | + int n = resolveRedirects(aliasTable, broaderTable, "broad_name", "broad", null, 1, null, null); |
770 | 770 | endTask("finishAliases", "resolveRedirects:broad", n+" entries"); |
771 | 771 | } |
772 | 772 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabasePropertyStoreBuilder.java |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | if (beginTask("finishAliases", "resolveRedirects:property")) { |
114 | 114 | RelationTable aliasTable = (RelationTable)conceptStoreSchema.getTable("alias"); |
115 | 115 | |
116 | | - int n = resolveRedirects(aliasTable, propertyTable, "concept_name", "concept", AliasScope.REDIRECT, 3, null); |
| 116 | + int n = resolveRedirects(aliasTable, propertyTable, "concept_name", "concept", AliasScope.REDIRECT, 3, null, null); |
117 | 117 | endTask("finishAliases", "resolveRedirects:property", n+" entries"); |
118 | 118 | } |
119 | 119 | } |