Search code examples
rets

Why does HasNext() return false, when


I am using libRets for .NET, and querying http://retsgw.flexmls.com/rets2_1/, using a valid user account. From C#, after calling Search() I check the count using GetCount() and I get 6300 results, but when I call HasNext() the first time returns false.

Checking the XML response, it looks like the results are empty () even though the result count provides a number.

So... where did the results go?

The exact query is the following:

http://retsgw.flexmls.com/rets2_1/Search?Class=OpenHouse&Count=1&QueryType=DMQL2&SearchType=OpenHouse&Select=ListingID&StandardNames=1

Here is the request:

SearchRequest request = client.CreateSearchRequest("OpenHouse", "OpenHouse", "");
request.SetStandardNames(true);
request.SetSelect("ListingID");

Here is how the request is made:

SearchResultSet result = client.Search(request);

Here is how the result is handled:

while (result.HasNext()) {
    // Do something
}

Solution

  • So, it looks like the FlexMLS Support was able to help (rather quickly).

    I needed to add &Format=COMPACT-DECODED to the query string.

    So, in the code it would look like this:

    request.SetFormatType(SearchRequest.FormatType.COMPACT_DECODED);