The attached code snippet produces incorrect distances when using the 'pythagorean' option to calulate distance, but is correct under 'great circle'. There are no indexes on my test tables. Texis version 05.01.1109947850 .
<$cat=($cat+ '%' )>
<apicp allinear 1>
<$null="">
<if $q neq "" and $where eq "">
<$cat="">
</if>
<sql row max=50 "select distgeocode(Geo, $curgeo, 'pythagorean' ) distance,
Link,Title,Body,City,State
from mytable where tablecat matches $cat and Title\Body like $q order by 1">
<div class=result>
<a href=$Link><b><fmt %s $Title></b></a> ($City,$State - <fmt "%.1f miles" $distance> )<br>
<fetch "" $Body>
<urltext>
<rex ">>=.{,160}[^\space]*" $ret>
$ret ...
</div>
<br>
</sql>
<$cat=($cat+ '%' )>
<apicp allinear 1>
<$null="">
<if $q neq "" and $where eq "">
<$cat="">
</if>
<sql row max=50 "select distgeocode(Geo, $curgeo, 'pythagorean' ) distance,
Link,Title,Body,City,State
from mytable where tablecat matches $cat and Title\Body like $q order by 1">
<div class=result>
<a href=$Link><b><fmt %s $Title></b></a> ($City,$State - <fmt "%.1f miles" $distance> )<br>
<fetch "" $Body>
<urltext>
<rex ">>=.{,160}[^\space]*" $ret>
$ret ...
</div>
<br>
</sql>