Fix search. - gopher-lawn - The gopher lawn gopher directory project.
(HTM) git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
---
(DIR) commit 33ab3e8d0d60e3457c3878ac97b5c4ad6ce10b74
(DIR) parent aa11f2c7f0c3d92013b95196aaf9be48ab267a50
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Fri, 28 Aug 2020 13:21:31 +0200
Fix search.
Diffstat:
M search.sh | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/search.sh b/search.sh
@@ -1,5 +1,7 @@
#!/bin/sh
-
+#
+# TODO: Add real search based on new db layout.
+#
if [ $# -lt 1 ];
then
@@ -9,14 +11,14 @@ fi
X_GOPHER_SEARCH="$1"
-for d in $(find . -type d | sed '/^\.\/\.git/d')
-do
- tr '\n' '\t' < $d/index.gph \
- | sed 's/\t\t/\n/g' \
- | grep '^\['
-done \
+cat c/*.gph \
+| tr '\n' '\t' \
+| sed 's,\t\t,\n,g' \
+| grep '^\[' \
| grep -v '^\[1|<< back|/lawn|server|port\]$' \
| grep -i "${X_GOPHER_SEARCH}" \
+| sort \
+| uniq \
| sed 's~^\[~\n&~' \
| tr '\t' '\n'