HashtagSell / posting-api

API for storage and retrieval of posting details for Hashtagsell
0 stars 0 forks source link

Category filtering not working on staging #52

Closed that1guy closed 9 years ago

that1guy commented 9 years ago

Staging ENV is simply not performing category filtering. I cannot reproduce this issue on my local machine so could be related to freeGeoIP outage. #51

Category filtering on staging returning everything.
https://staging-posting-api.hashtagsell.com/v1/postings/?start=0&count=500&filters[mandatory][contains][heading]=mini%20pool%20table&filters[optional][exact][categoryCode]=SELE&geo[coords]=-122.431297,37.773972&geo[min]=0&geo[max]=100000
Staging response
{
  "options": {
    "count": "500",
    "filters": {
      "mandatory": {
        "contains": {
          "heading": "mini pool table"
        }
      },
      "optional": {
        "exact": {
          "categoryCode": "SFUR"
        }
      }
    },
    "geo": {
      "coords": [
        -122.431297,
        37.773972
      ],
      "min": 0,
      "max": 100000
    },
    "sort": {},
    "start": "0"
  },
  "results": [
    {
      "username": "n9fsq-5004494913@hous.craigslist.org",
      "heading": "St. Regis Luxurious 2BD/2.5BA Condo w/ Views, Pool, Concierge  Pkg.",
      "body": "\n CONTACT INFO Susie\n Feel free to Text, Email or Call Luxurious St. Regis Residences 2BD/2.5 Bath Condo with Views, 24 Concierge Doorman, Pool, Spa & Pkg. - $11,950.00 per month 188 Minna Street, San Francisco, CA 94105 FEATURES Bedrooms:  2 Bathrooms:  2.5 Located on Floor #:  27 Floors in Bldg:  40 Square Footage:  Approx. 1770 Parking Spaces:  1 Property Type:  Condo Pets Allowed:  None Year Built:  2005 Agent Name:  Susie Living Room:  1 DESCRIPTION The St. Regis Residences is a Luxury Boutique Full Service/24 hour Doorman Building offering 5-Star Services. The Building Amenities include Concierge Service, 24 Hour Security, an on demand Butler, Room Service,Valet Parking, Fitness Center, Yoga Room, Spa, Heated Indoor Pool, Roof Deck to enjoy the City Views, Lounge and Two Restaurants, Vitrine and Ame.   -Northwest corner view unit -Spacious Open Living/Dining Area -Dark Hardwood Floors throughout -Gourmet Kitchen with Gas Stove, Refrigerator, Dishwasher & Disposal -Luxury Master Bedroom with Marble Bathroom (Walk-In Shower, Soak-in Tub and Dual   Sink) -Second Bedroom with Full Bathroom -Powder Room/Half Bath -Washer/Dryer -One Car Parking Included   -Heat/Air Conditioner -Water & Garbage are Included  NO SMOKERS/PETS Shown by Appt. NO FEE/Agent Cal BRE 01368328 Phone:\n RENTAL UNIT AMENITIES Refrigerator Dishwasher Washer/Dryer Hardwood Floors Gas Stove BUILDING AMENITIES Swimming Pool Exercise Room 24 Hr. Concierge Spa Roof Deck Butler Service Valet Parking Lounge & Restaurants OTHER AMENITIES Guest Parking High-Speed Internet Hardwood Floors Microwave OTHER PRICING DETAILS Available Date:   Tue May 05, 2015 Deposit:   17925.00 Minimum Lease:   1 Year Lease Included Utilities:   Water & Garbage\n ",
      "expiresAt": "2015-05-26T16:27:20.692Z",
      "categoryCode": "RHFR",
      "annotations": {
        "bedrooms": "2br",
        "year": "2005",
        "attached_garage": "YES",
        "source_subcat": "apa|apa",
        "condo": "YES",
        "original_posting_date": "1430462030",
        "gzip_data_size": "6789",
        "source_account": "n9fsq-5004494913@hous.craigslist.org",
        "phone": "4157301309",
        "proxy_ip": "104.236.83.219:22225",
        "source_heading": "St. Regis Luxurious 2BD/2.5BA Condo w/ Views, Pool, Concierge & Pkg.",
        "latlong_source": "In Posting",
        "no_smoking": "YES",
        "sqft": "1767",
        "source_map_yahoo": "http://maps.yahoo.com/maps_result?addr=%31%38%38+Minna&csz=San+Francisco+CA&country=US",
        "available": "may 01",
        "source_map_google": "https://maps.google.com/?q=loc%3A+%31%38%38+Minna+San+Francisco+CA+US",
        "html_data_size": "23884",
        "source_subloc": "sfc",
        "source_loc": "sfbay",
        "w_d_in_unit": "YES",
        "source_state": "California",
        "source_neighborhood": "SOMA / south beach",
        "source_cat": "hhh",
        "source_continent": "USA",
        "bathrooms": "2.5ba"
      },
brozeph commented 9 years ago

If you are attempting to filter to 1 category, this does not work when it is supplied as optional in the query params. If filtering to postings within a single category, supply that category as mandatory (think of the mandatory clause as AND and the optional clause as OR).

that1guy commented 9 years ago

Sorry! Going to implement now!

that1guy commented 9 years ago

For now I'm implementing workaround that always passes in two categories at minimum. When I convert my query objects from dot notation to the required bracket notation url for posting api I run into a very odd issue that I can't resolve at moment.