Incorrect results for listings grouped in the same development
See original GitHub issueWhen we find grouped listings in a search, the price is returned as “from x” where x is the lowest price in the development. Similarly in such cases the number of bedrooms we get back contains all those in the development e.g. “1, 2, 3 & 4 bed”, and the number of bathrooms is not obtained at all. For example if we run the following example with a minimum price of 7500:
import pandas as pd
from daftlistings import Daft, Location, SearchType, PropertyType, SortType, MapVisualization
daft = Daft()
daft.set_location(Location.DUBLIN)
daft.set_search_type(SearchType.RESIDENTIAL_RENT)
daft.set_property_type(PropertyType.APARTMENT)
daft.set_sort_type(SortType.PRICE_DESC)
daft.set_min_price(7500)
listings = daft.search()
# cache the listings in the local file
with open("result.txt", "w") as fp:
fp.writelines("%s\n" % listing.as_dict_for_mapping() for listing in listings)
# read from the local file
with open("result.txt") as fp:
lines = fp.readlines()
properties = []
for line in lines:
properties.append(eval(line))
df = pd.DataFrame(properties)
print(df)
The results look like:
i.e. We are mostly finding prices not satisfying our search criteria.
If we go to the daft link for the second result we find:
i.e. The reason is that there are properties satisfying the search requirements in the development, but the entire development is returned as a single listing so we don’t distinguish between these properties leading to incorrect results.
I have a fix ready for this that expands such listings so that each property within the development becomes a separate listing and I’ll be ready to pull request it soon.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
In my experience using the actual site, for some searches quite a lot are grouped in this way, so I’m not sure how good it would be to remove them. The search does return the necessary information on these sub listings to make them into individual listings. The fix I had previously put a pull request in for does actually work in the case of house and apartment searches. it just threw up an error I hadn’t anticipated in the case of studios because they have no numBedrooms. It should be easy enough to work around though I think. I was planning to look into this tomorrow or Saturday, I just didn’t have time when I first realised the problem. It should work though to expand them out into individual listings instead of removing them.
From taking a look into this, it appears Daft returns listings sorted by premium and featured developments (looks like paid advertisements to me). One way around this would be to omit those results from the listings object that is returned. This could potentially yield more accurate results. What do you think?