-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_search_index.sh
More file actions
98 lines (82 loc) · 2.44 KB
/
build_search_index.sh
File metadata and controls
98 lines (82 loc) · 2.44 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
set -e
# Test script for building the full-text search index locally.
# Mirrors the build-search-index.yml workflow (except deploy step).
#
# Prerequisites: Hugo v0.101.0+ extended must be installed.
# Usage: bash build_search_index.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "=== Checking Hugo ==="
if ! command -v hugo &> /dev/null; then
echo "Error: Hugo is not installed. Install hugo_extended v0.101.0+"
exit 1
fi
hugo version
echo ""
echo "=== Downloading documentation repositories ==="
# Each entry is "product_key:ProductName"
# Repo URL pattern: https://github.com/groupdocs-{key}/GroupDocs.{Name}-Docs
PRODUCTS="
annotation:Annotation
assembly:Assembly
classification:Classification
comparison:Comparison
conversion:Conversion
editor:Editor
markdown:Markdown
merger:Merger
metadata:Metadata
parser:Parser
redaction:Redaction
search:Search
signature:Signature
total:Total
viewer:Viewer
watermark:Watermark
"
for entry in $PRODUCTS; do
product="${entry%%:*}"
product_name="${entry##*:}"
repo_url="https://github.com/groupdocs-${product}/GroupDocs.${product_name}-Docs.git"
echo ""
echo "--- Downloading ${product} documentation ---"
echo "Repository: groupdocs-${product}/GroupDocs.${product_name}-Docs"
git clone --depth 1 "${repo_url}" "temp-${product}" 2>&1 || {
echo "WARNING: Failed to clone GroupDocs.${product_name}-Docs, skipping."
continue
}
# Create content directory for this product
mkdir -p "content/${product}"
# Copy product family index page
if [ -f "temp-${product}/_index.md" ]; then
cp "temp-${product}/_index.md" "content/${product}/"
echo "Copied _index.md"
fi
# Copy platform-specific documentation folders
for platform in net java nodejs-java python-net; do
if [ -d "temp-${product}/${platform}" ]; then
cp -r "temp-${product}/${platform}" "content/${product}/"
echo "Copied ${platform}/ folder"
fi
done
# Cleanup cloned repo
rm -rf "temp-${product}"
done
echo ""
echo "=== Content structure ==="
ls -la content/
echo ""
echo "=== Building site ==="
hugo
echo ""
echo "=== Verifying index.json ==="
if [ ! -f "./public/index.json" ]; then
echo "ERROR: index.json was not generated"
exit 1
fi
echo "index.json size: $(wc -c < ./public/index.json) bytes"
echo "Number of entries: $(grep -c '"id"' ./public/index.json || echo 0)"
echo ""
echo "Output: public/index.json"
echo "Done."