-2

I'm working on a real estate site and have been able to show the listings from rets server.I am using phrets. I can't make the search system work properly. Here is my search query :

  $search = $rets->SearchQuery(
        'Property',     // Resource
        1,      // Class
         '((130=2013-10-02T16:00:00+),(213=A))',    // DMQL
        array(
            'Format'    => 'COMPACT-DECODED',
            'Select'    => 'sysid,13,1491',
             'Count'        => 1,
             'Limit'        => 3
            )
        );

130=system for last update date.

213=system name for status.

It works well.It can pull all the listings i want. But i went through some real estate site. They execute a search query at the very first page. When someone writes down 3 or more letters in the input box, a dropdown list appears down the input box which contains handful cities started with those letters and on click any of the cities pulls the listings form that city.

But here in my case my system name for city is 1491 and when i write (1491=somerset) it pulls all the listings in the somerset city. I am wondering how i can do the first step while writing down couple of letters will show me the name of the cities relating to those letters.

As DMQL query suggest me to do this way (1491=*som*) it should bring up all the cities that contain 'som'. But i can't make it work. I am trying very hard over the last few days and with the very few resource in internet i find myself not able to figure it out.

Any help would greatly be appreciated.

ray
  • 457
  • 3
  • 9
efat
  • 43
  • 4
  • http://stackoverflow.com/questions/17938394/cant-get-results-from-searchquery-in-phrets – ray Sep 09 '14 at 07:30

2 Answers2

0

Try urlencoding your query string. Plus signs often do not get encoded, and thus are ignored when the request is processed. You could also use the NOW token and send it as (130=2013-10-02T16:00:00-NOW),(213=A)

0

RETS itself doesn't really provide you with a way to do this efficiently. Although there may be done other, crazier ways to do this, the 2 main ones would be:

1) Download the metadata from the server so that you have each fields' lookups in a local database where you could do these more dynamic queries.

2) When someone puts in the 3 letters, have a backend process retrieve the lookup values for the city field and try to locate possible matches directly with PHP.

Of these 2 options, I would highly recommend the first as it would faster and more capable.

Once your visitor has used your suggestion to select a city of interest, you can then use that value in your RETS search using a basic exact match condition.

troydavisson
  • 341
  • 1
  • 4