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
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
diff --git a/src/executables/ArcTool.php b/src/executables/ArcTool.php
index b0b0c71d5..6cf4047e0 100755
--- a/src/executables/ArcTool.php
+++ b/src/executables/ArcTool.php
@@ -149,6 +149,11 @@ class ArcTool extends DictionaryUpdater implements CrawlConstants
intval($argv[4]));
break;
case "dict":
+ if (isset($argv[4]) && $argv[4] == 'details') {
+ $argv[4] = -1;
+ $argv[5] = -1;
+ $argv[6] = "details";
+ }
$argv[4] = (isset($argv[4])) ? intval($argv[4]) : -1;
$argv[5] = (isset($argv[5])) ? intval($argv[5]) : -1;
$argv[6] = (!empty($argv[6]) && $argv[6] == "details") ?
@@ -421,11 +426,12 @@ class ArcTool extends DictionaryUpdater implements CrawlConstants
$postings_len = (empty($record['POSTINGS_LEN']))?
-1 : $record['POSTINGS_LEN'];
}
- if ($postings_offset == -1) {
+ $is_postings_array = isset($record['POSTINGS']) &&
+ is_array($record['POSTINGS']);
+ if ($postings_offset == -1 && !$is_postings_array) {
echo "No POSTINGS_LEN or LAST_BLOB_LEN, record postings".
" cannot be looked up\n";
- } else if (isset($record['POSTINGS']) &&
- is_array($record['POSTINGS'])) {
+ } else if ($is_postings_array) {
echo "Active Record\n-------------\n";
echo "By default list details of all postings\n";
var_dump($record['POSTINGS']);
@@ -1447,16 +1453,16 @@ php ArcTool.php doc-lookup bundle_name partition doc_map_index
returns the document stored in partition at doc_map_index
(here doc_map_index is the value that would be stored in a posting)
*/
-php ArcTool.php dict bundle_name word
-php ArcTool.php dict double_index_name which_bundle word
+php ArcTool.php dict bundle_name word [details]
+php ArcTool.php dict double_index_name which_bundle word [details]
php ArcTool.php dict bundle_name word start_record num_records [details]
php ArcTool.php dict double_index_name which_bundle word start_record num_records [details]
/* returns index dictionary records for word stored in index archive bundle
or double index bundle. In the later case you should provide which bundle
you want dictionary info for. This command also supports start
and number of record parameters. If the word details is added to the end
- of the command in the last two forms then additional information about each
- doc in a record (as opposed to just their total number) is printed
+ of the command then additional information about each
+ doc record (as opposed to just their total number) is printed
*/
php ArcTool.php fix-partition bundle_name