summaryrefslogtreecommitdiffstats
path: root/searchcore/util
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /searchcore/util
Publish
Diffstat (limited to 'searchcore/util')
-rw-r--r--searchcore/util/showschema.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/searchcore/util/showschema.pl b/searchcore/util/showschema.pl
new file mode 100644
index 00000000000..4cd4fb8c310
--- /dev/null
+++ b/searchcore/util/showschema.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+while ( <STDIN> ) {
+ if ( m/^indexfield\[(\d+)\]$/ ) {
+ $numfields = $1;
+ print "$numfields fields\n";
+ next;
+ }
+ if ( m/^indexfield\[(\d+)\]\.(\w+) (.*)$/ ) {
+ $ifield[$1]{$2} = $3;
+ next;
+ }
+ if ( m/^fieldcollection\[(\d+)\]$/ ) {
+ $numfc = $1;
+ }
+ if ( m/^fieldcollection\[(\d+)\]\.name (.*)$/ ) {
+ $fieldcoll[$1]{name} = $2;
+ next;
+ }
+ if ( m/^fieldcollection\[(\d+)\]\.field\[\d+\]$/ ) {
+# $fieldcoll[$1]{fields} = [ ];
+ next;
+ }
+ if ( m/^fieldcollection\[(\d+)\]\.field\[\d+\]\.name (.*)$/ ) {
+ push(@{$fieldcoll[$1]{fields}}, $2);
+ next;
+ }
+}
+for ( $f = 0; $f < $numfields; ++$f) {
+ printf "indexfield %s %s %s %s %s %s\n",
+ $ifield[$f]{name}, $ifield[$f]{datatype}, $ifield[$f]{collectiontype},
+ $ifield[$f]{prefix}, $ifield[$f]{phrases}, $ifield[$f]{positions};
+}
+for ($fc = 0; $fc < $numfc; ++$fc) {
+ printf "fieldcoll %s -> %s\n", $fieldcoll[$fc]{name},
+ join(' ', @{$fieldcoll[$fc]{fields}});
+}