r48939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48938‎ | r48939 | r48940 >
Date:22:07, 27 March 2009
Author:daniel
Status:deferred
Tags:
Comment:
force index for resolve-alias
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabasePropertyStoreBuilder.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java
@@ -460,9 +460,10 @@
461461 }
462462 }
463463
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 {
465465 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);
467468
468469 DatabaseField nmField = relNameField ==null ? null : table.getField(relNameField);
469470 DatabaseField idField = relIdField == null ? null : table.getField(relIdField);
@@ -477,8 +478,9 @@
478479
479480
480481 String sql = "UPDATE "+table.getSQLName()+" as R "
481 - + (forceIndex!=null ? " force index ("+forceIndex+") " : "")
 482+ + (forceRIndex!=null ? " force index ("+forceRIndex+") " : "")
482483 + " JOIN "+aliasTable.getSQLName()+" as E "
 484+ + (forceEIndex!=null ? " force index ("+forceEIndex+") " : "")
483485 + ((idField!=null) ? " ON R."+relIdField+" = E.source " : " ON R."+relNameField+" = E.source_name ")
484486 + " SET ";
485487
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java
@@ -676,7 +676,7 @@
677677 //NOTE: need to resolve category-aliases here, so no concepts are generated for aliased categories!
678678 //NOTE: bad category redirs have been droped in finishBadLinks
679679 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);
681681 endTask("finishMissingConcpets", "resolveRedirects:broader", n+" entries");
682682 }
683683
@@ -748,24 +748,24 @@
749749 if (beginTask("finishAliases", "resolveRedirects:link")) {
750750 //XXX: SLOW!
751751 //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");
753753 endTask("finishAliases", "resolveRedirects:link", n+" entries");
754754 }
755755
756756 //NOTE: broader.broad_name already done in finishMissingConcepts for AliasScope.BROADER
757757
758758 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);
760760 endTask("finishAliases", "resolveRedirects:about", n+" entries");
761761 }
762762
763763 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);
765765 endTask("finishAliases", "resolveRedirects:narrow", n+" entries");
766766 }
767767
768768 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);
770770 endTask("finishAliases", "resolveRedirects:broad", n+" entries");
771771 }
772772
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabasePropertyStoreBuilder.java
@@ -112,7 +112,7 @@
113113 if (beginTask("finishAliases", "resolveRedirects:property")) {
114114 RelationTable aliasTable = (RelationTable)conceptStoreSchema.getTable("alias");
115115
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);
117117 endTask("finishAliases", "resolveRedirects:property", n+" entries");
118118 }
119119 }

Status & tagging log