Quero encontrar empresas perto de um ponto que contenha uma palavra que comece com mar
lat=-6.185068&long=106.773121&keyword=sea&distance=5000&startfrom=0&howmany=20&prominent=5
SELECT DISTINCT
TB.ID,
TB.Latitude,
TB.Longitude,
111151.29341326*SQRT(pow(-6.185-TB.Latitude,2)+pow(106.773-TB.Longitude,2)*0.98839228980165) AS Distance
FROM
`tablebusiness` AS TB
join tableauxiliary as TA on TA.BusinessID=TB.ID
WHERE
TB.Latitude >-6.2317830813328 AND TB.Latitude < -6.1382169186672
AND TB.Longitude >106.72621691867 AND TB.Longitude <106.81978308133
AND MATCH (TA.FullTextSearch) AGAINST ('sea*' IN BOOLEAN MODE)
AND TA.Prominent >5
ORDER BY
Distance
LIMIT
0, 20
Eu tenho esses resultados:
rasane__-6.18_106.77 -6.1826789706189 106.774375525435 299.434343596808
seafood-bangka---jakarta__-6.18_106.77 -6.18410749805068 106.767679452896 596.253784623613
seafood-sari-laut__-6.19_106.78 -6.18661497692636 106.7816047167 967.65389600759
rasane-seafood-restaurant__-6.18_106.76 -6.18244550827744 106.763621456218 1074.56073316741
pecel-lele-lela__-6.19_106.78 -6.18836286783996 106.782370851856 1100.91660371997
bintang-laut-seafood__-6.18_106.77 -6.17782494896301 106.766016483307 1109.75958732106
d'cost-itc-permata-hijau__-6.19_106.77 -6.19494204046746 106.770504692048 1138.95344788546
masterpiece---car-leather-seat-and-interior__-6.18... -6.18373417378944 106.783719062805 1192.82955595065
seafood-makasar__-6.18_106.78 -6.17684 106.780666 1241.07275264282
hongkong-jumbo-seafood-restaurant__-6.20_106.77 -6.19668602280699 106.771334150698 1311.89593536338
plg-(pecel-lele-greenville)__-6.17_106.78 -6.17354759635866 106.7768121112 1340.84148631128
makassar__-6.18_106.78 -6.17990504916375 106.784087464957 1349.76048368113
makassar-seafood__-6.20_106.77 -6.19642790400783 106.768355369568 1370.00078243887
pelangi-seafood__-6.17_106.78 -6.1733876537374 106.777818202972 1396.23099579268
sea-food-sari-laut-kemanggisan__-6.19_106.79 -6.188395 106.7853 1410.61411729396
seafood-toni-k__-6.19_106.79 -6.188435 106.785291 1410.85254243932
seafood-sari-laut-tony-koeswoyo__-6.19_106.79 -6.188445 106.785417 1424.55989808634
makassar-seafood-restaurant__-6.18_106.78 -6.177669 106.783744 1439.9871117091
sea-food-38-kebon-jeruk__-6.20_106.77 -6.19710303086272 106.767730987066 1465.8643124913
seafood-38-(lap.-bola)__-6.20_106.77 -6.197078 106.767655 1466.67274960557
Agora eu executo a consulta semelhante com base em algo ligeiramente diferente lat=-6.185564&long=106.775518&keyword=Sea&distance=5000&startfrom=0&howmany=20&prominent=5 Observe que lat e long diferem apenas um pouco
A consulta não muda muito
SELECT DISTINCT
TB.ID,
TB.Latitude,
TB.Longitude,
111151.29341326*SQRT(pow(-6.186-TB.Latitude,2)+pow(106.776-TB.Longitude,2)*0.98838855059148) AS Distance
FROM
`tablebusiness` AS TB
join tableauxiliary as TA on TA.BusinessID=TB.ID
WHERE
TB.Latitude >-6.2327830813328 AND TB.Latitude < -6.1392169186672
AND TB.Longitude >106.72921691867 AND TB.Longitude <106.82278308133
AND MATCH (TA.FullTextSearch) AGAINST ('Sea*' IN BOOLEAN MODE)
AND TA.Prominent >5
ORDER BY
Distance
LIMIT
0, 20
Este retorna vazio
Coloquei as 2 consultas lado a lado. Obviamente muitos dos resultados estão dentro do retângulo.
Por quê?
Alguém pode identificar alguns erros óbvios neles? Talvez eu tenha feito algo errado no comando SQL
Você escreve mar* aqui e mar* ali. Este relatório de bug (que acabou não relatando um bug, mas um recurso enigmático (pelo menos para mim)) pode ser útil para você. (Encontrei o link pesquisando diferenciação de maiúsculas e minúsculas na pesquisa de texto completo.)