Further work on simplifying the use of the ArcTool dict command so can use details even if don't list start and number of records 2
Further work on simplifying the use of the ArcTool dict command so can use details even if don't list start and number of records 2
diff --git a/src/executables/ArcTool.php b/src/executables/ArcTool.php
index 6cf4047e0..08997717a 100755
--- a/src/executables/ArcTool.php
+++ b/src/executables/ArcTool.php
@@ -410,12 +410,13 @@ class ArcTool extends DictionaryUpdater implements CrawlConstants
echo "====================================\n";
$i = 0;
$archive_file = $info['ARCHIVE_FILE'];
+ $is_old_index = $index->archive_info['VERSION'] < "3.2";
foreach ($info['ROWS'] as $record) {
if ($start_record < 0 || $record['PARTITION'] >= $start_record) {
echo "RECORD: $i\n";
echo "PARTITION: {$record['PARTITION']}\n";
echo "NUMBER OF DOCS: {$record['NUM_DOCS']}\n\n";
- if ($index->archive_info['VERSION'] < "3.2") {
+ if ($is_old_index) {
$postings_offset = (empty($record['POSTINGS'])) ?
-1: $record['POSTINGS'];
$postings_len = (empty($record['LAST_BLOB_LEN'])) ?
@@ -436,9 +437,15 @@ class ArcTool extends DictionaryUpdater implements CrawlConstants
echo "By default list details of all postings\n";
var_dump($record['POSTINGS']);
} else if ($details) {
- $postings_entry = $index->dictionary->getArchive(
- $archive_file, $postings_offset,
- $postings_len);
+ if ($is_old_index) {
+ $postings_entry = $index->dictionary->getArchive(
+ $archive_file, $postings_offset,
+ $postings_len);
+ } else {
+ $postings_entry = $index->dictionary->getPostingsString(
+ $record['PARTITION'], $postings_offset,
+ $postings_len);
+ }
$postings = $index->postings_tools->unpack($postings_entry);
$index->deDeltaPostingsSumFrequencies($postings);
var_dump($postings);