blob: 5ded4505ea59f2a4d25a73fc152c41b3be18edf7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/perl
# Copyright 2017 Yahoo Holdings. 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}});
}
|