reverse phrase search in zend lucene

2019-08-10 21:04发布

Basically I have two tables Location and city, The city has city_name and country_code. location_name field from location table has locations. I want to find the location country.

My table structure.

City table

City

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

Location table

Location

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

So I Indexed the two fields(country_code and city_name) in city table using Zend Lucene search. I will get the location name from table location and search against the Lucene index using keyword query.

I found lots of matched because of the term "city". So decided to change it phrase search. phrase search like "Kansas city, mo" this, but I found no result. So I realized I want to search the "Kansas city" against keyword "Kansas city, mo". Is that possible to do reverse search or anyway to do relationship with location table index and find the country code.

0条回答
登录 后发表回答