1

基本上我有两张表Locationcity, City 有 city_name 和 country_code。位置表中的 location_name 字段具有位置。我想找到位置国家。

我的表结构。

城市表

City

country_code   city_name
US             Kansas city
.........
(thousands of world country cities) 

位置表

Location

location_name
Kansas city, mo
Kansas city
Kansas city, us
uSA, Kansas city
etc...

所以我使用 Zend Lucene 搜索在城市表中索引了两个字段(国家代码和城市名称)。我将从表位置获取位置名称,并使用关键字查询对 Lucene 索引进行搜索。

由于“城市”一词,我发现了很多匹配项。因此决定将其更改为词组搜索。像“Kansas city, mo”这样的短语搜索,但我没有找到结果。所以我意识到我想针对关键字“堪萨斯城,莫”搜索“堪萨斯城”。是否可以进行反向搜索或无论如何与位置表索引建立关系并找到国家代码

4

0 回答 0