Full text Search with Geospatial Queries in PHP sdk


#1

Hi there,

i was trying to achieve below using couchbase fts i have one search term and multiple filters in strings, and latitude and longitude data, i wanted to filter the result matching to the search term within 5 mile range…

using php sdk i have only found this document so far…

https://developer.couchbase.com/documentation/server/5.5/sdk/php/full-text-searching-with-sdk.html

but this is not enough,
I have created full text indexing and other part its is kind of working from admin panel.

But I want to know how I can call this search term with location and filter from php …

please direct me in a correct route :-

thank you very much in advance


#2

You can use \Couchbase\SearchQuery::geoDistance() and \Couchbase\SearchQuery::geoBoundingBox() queries:

http://docs.couchbase.com/sdk-api/couchbase-php-client-2.4.6/classes/Couchbase.SearchQuery.html#method_geoDistance


#3

Thanks avsej for those links:- i have go through them and trying get an example.
Please have look on my below question, any sort of help will greatly appreciated

i have document model like this for full text search:-

{
  "typeTarget": "company",
  "title": "my first company name xyz",
  "details": "details for company xyz",
  "mainImage": {
    "fileId": "file::d47ee81e41803e3498cb4128ebbc6c56"
  },
  "location": {
    "lat": 50.962097,
    "lon": 1.954764,
  },
  "prizeRange": "100-999",
  "category" :"Tv, Smart Tv, Curved TV, LCD",
  "priceRangeString": false,
  "targetId": "comp:I:T:xyz:21012323",
  "visibility": false,
  "deleted": false,
  "supportingFiles": [
    {}
  ],
  "created": "2018-05-12 20:14:05",
  "updated": "2018-05-14 20:14:05",
  "_class": "Entity.SearchIndexer"
}

in the fts index i kept _class as json type field and type mappings were added for Entity.SearchIndexer

and also added child field for title, details (as text type) and for location (as geopoint)

suppose i have 100 of document like this with different data
what i am trying to do here is full text search to find a company “xyz” with category “Smart TV” within the range of 5 miles (50.962097, 1.954764)
and prizeRange equal to “100-999”

and also expecting search result returns title,targetId,updated,typeTarget these fields:-

is it possible to do such kind of search with multiple filter with couchbase fts, i

Please please help me i am kindly requesting you to add a php querying example for this use case…

i tried many ways but not clear or could not find any working example in web for this kind of query…