Index: trunk/extensions/Wikidata/Database scripts/Convenience/Create bootstrapped_defined_meanings indices.sql |
— | — | @@ -1,3 +0,0 @@ |
2 | | -ALTER TABLE `bootstrapped_defined_meanings` |
3 | | - ADD INDEX `unversioned_meaning` (`defined_meaning_id`), |
4 | | - ADD INDEX `unversioned_name` (`name` (255), `defined_meaning_id`); |
Index: trunk/extensions/Wikidata/Database scripts/Convenience/Recreate indexes for all tables for website.php |
— | — | @@ -48,11 +48,11 @@ |
49 | 49 | echo "Dropping indices from table " . $dc . "_" . $tableName . ".\n"; |
50 | 50 | dropAllIndicesFromTable($dc . "_" . $tableName); |
51 | 51 | echo "Creating new indices for table " . $dc . "_" . $tableName . ".\n"; |
52 | | - createIndexesForTable($dc,$tableName); |
| 52 | + createIndexesForTable($dc, $tableName); |
53 | 53 | } |
54 | 54 | |
55 | | -function addIndexesForTable($table) { |
56 | | - $tableIndexes = $table->getIndexes("WebSite"); |
| 55 | +function addIndexesForTable($table, $purpose) { |
| 56 | + $tableIndexes = $table->getIndexes($purpose); |
57 | 57 | $indexes = array(); |
58 | 58 | |
59 | 59 | foreach ($tableIndexes as $tableIndex) { |
— | — | @@ -74,12 +74,12 @@ |
75 | 75 | addIndexes($table->getIdentifier(), $indexes); |
76 | 76 | } |
77 | 77 | |
78 | | -function recreateIndexesForTableNew(Table $table) { |
| 78 | +function recreateIndexesForTableNew(Table $table, $purpose) { |
79 | 79 | echo "Dropping indices from table " . $table->getIdentifier() . ".\n"; |
80 | 80 | dropAllIndicesFromTable($table->getIdentifier()); |
81 | 81 | |
82 | 82 | echo "Creating new indices for table " . $table->getIdentifier() . ".\n"; |
83 | | - addIndexesForTable($table); |
| 83 | + addIndexesForTable($table, $purpose); |
84 | 84 | } |
85 | 85 | |
86 | 86 | function recreateIndexesForTables($dc, $tableNames) { |
— | — | @@ -95,7 +95,6 @@ |
96 | 96 | $dc = "uw"; |
97 | 97 | |
98 | 98 | $tables = array( |
99 | | - "bootstrapped_defined_meanings", |
100 | 99 | "transactions", |
101 | 100 | "translated_content", |
102 | 101 | "alt_meaningtexts", |
— | — | @@ -113,11 +112,13 @@ |
114 | 113 | "url_attribute_values" |
115 | 114 | ); |
116 | 115 | |
| 116 | +$purpose = "WebSite"; |
117 | 117 | $prefixes = retrieve_datasets(); |
118 | 118 | |
119 | 119 | foreach($prefixes as $prefix) { |
120 | 120 | $dataSet = new WikiDataSet($prefix); |
121 | | - recreateIndexesForTableNew($dataSet->expression); |
| 121 | + recreateIndexesForTableNew($dataSet->bootstrappedDefinedMeanings, $purpose); |
| 122 | + recreateIndexesForTableNew($dataSet->expression, $purpose); |
122 | 123 | |
123 | 124 | recreateIndexesForTables($prefix, $tables); |
124 | 125 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php |
— | — | @@ -105,8 +105,8 @@ |
106 | 106 | return $this->identifier; |
107 | 107 | } |
108 | 108 | |
109 | | - protected function createColumn($identifier) { |
110 | | - $result = new TableColumn($this, $identifier); |
| 109 | + protected function createColumn($identifier, $length = null) { |
| 110 | + $result = new TableColumn($this, $identifier, $length); |
111 | 111 | $this->columns[] = $result; |
112 | 112 | |
113 | 113 | return $result; |
— | — | @@ -194,10 +194,14 @@ |
195 | 195 | public function __construct($identifier) { |
196 | 196 | parent::__construct($identifier, false); |
197 | 197 | |
198 | | - $this->name = $this->createColumn("name"); |
| 198 | + $this->name = $this->createColumn("name", 255); |
199 | 199 | $this->definedMeaningId = $this->createColumn("defined_meaning_id"); |
200 | 200 | |
201 | | - $this->setKeyColumns(array($this->name)); |
| 201 | + $this->setKeyColumns(array($this->name)); |
| 202 | + $this->setWebSiteIndexes(array( |
| 203 | + new TableIndex("unversioned_meaning", array($this->definedMeaningId)), |
| 204 | + new TableIndex("unversioned_name", array($this->name, $this->definedMeaningId)) |
| 205 | + )); |
202 | 206 | } |
203 | 207 | } |
204 | 208 | |
— | — | @@ -262,7 +266,7 @@ |
263 | 267 | parent::__construct($name); |
264 | 268 | |
265 | 269 | $this->expressionId = $this->createColumn("expression_id"); |
266 | | - $this->spelling = $this->createColumn("spelling"); |
| 270 | + $this->spelling = $this->createColumn("spelling", 255); |
267 | 271 | $this->languageId = $this->createColumn("language_id"); |
268 | 272 | |
269 | 273 | $this->setKeyColumns(array($this->expressionId)); |
— | — | @@ -275,7 +279,7 @@ |
276 | 280 | array($this->languageId, $this->expressionId) |
277 | 281 | ), |
278 | 282 | $this->createVersionedIndexes("spelling", true, true, false, |
279 | | - array($this->spelling->subPart(255),$this->languageId, $this->expressionId) |
| 283 | + array($this->spelling, $this->languageId, $this->expressionId) |
280 | 284 | ) |
281 | 285 | )); |
282 | 286 | } |