+searchteaser() {
+ local file="$1" words db3_data
+ local w l nc nl hits mhits cont mcont
+ shift 1; words="$*"
+
+ for w in ${words}; do
+ grep -hiwnF "$w" "$file"
+ done \
+ | sort -t: -k1 -n \
+ | { nc=-1 hits=0 mhits=0
+ while read -r l; do
+ nl="$nc" nc="${l%%:*}"
+ if [ $nc -eq $nl ]; then
+ hits=$((hits + 1))
+ elif [ $nc -eq $((nl + 1 )) ]; then
+ hits=$((hits + 1))
+ cont="${cont}${BR}${l#*:}"
+ elif [ $hits -gt $mhits ]; then
+ mhits="$hits" mcont="$cont"
+ hits=1 cont="${l#*:}"
+ else
+ hits=1 cont="${l#*:}"
+ fi
+ done
+
+ [ $hits -gt $mhits ] \
+ && STRING "$cont" \
+ || STRING "$mcont"
+ }
+}
+