1
0
-1

Hello, this is the example from Sample API requests for public search. I am running into an issue where filter processing only works for location and distance radius when it equals "" (empty) or "1". 

{
"apikey":"{{apikey}}",
"objectType":"animals",
"objectAction":"publicSearch",
"search":
{
"resultStart": "0",
"resultLimit": "10",
"resultSort": "animalID",
"resultOrder": "asc",
"filters":
[
{
"fieldName": "animalStatus",
"operation": "equals",
"criteria": "Available"
},
{
"fieldName": "animalLocationDistance",
"operation": "radius",
"criteria": "25"
},
{
"fieldName": "animalLocation",
"operation": "equals",
"criteria": "20715"
}
],
"filterProcessing": "1",
"fields":
[
"animalID","animalOrgID","animalActivityLevel","animalAdoptedDate","animalAdoptionFee","animalAgeString","animalAltered","animalAvailableDate","animalBirthdate","animalBirthdateExact","animalBreed","animalCoatLength","animalColor","animalColorID","animalColorDetails","animalCourtesy","animalDeclawed","animalDescription","animalDescriptionPlain","animalDistinguishingMarks","animalEarType","animalEnergyLevel","animalExerciseNeeds","animalEyeColor","animalFence","animalFound","animalFoundDate","animalFoundPostalcode","animalGeneralAge","animalGeneralSizePotential","animalGroomingNeeds","animalHousetrained","animalIndoorOutdoor","animalKillDate","animalKillReason","animalLocation","animalLocationCoordinates","animalLocationDistance","animalLocationCitystate","animalMicrochipped","animalMixedBreed","animalName","animalSpecialneeds","animalSpecialneedsDescription","animalNeedsFoster","animalNewPeople","animalNotHousetrainedReason","animalObedienceTraining","animalOKWithAdults","animalOKWithCats","animalOKWithDogs","animalOKWithKids","animalOwnerExperience","animalPattern","animalPatternID","animalAdoptionPending","animalPrimaryBreed","animalPrimaryBreedID","animalRescueID","animalSearchString","animalSecondaryBreed","animalSecondaryBreedID","animalSex","animalShedding","animalSizeCurrent","animalSizePotential","animalSizeUOM","animalSpecies","animalSpeciesID","animalSponsorable","animalSponsors","animalSponsorshipDetails","animalSponsorshipMinimum","animalStatus","animalStatusID","animalSummary","animalTailType","animalThumbnailUrl","animalUptodate","animalUpdatedDate","animalUrl","animalVocal","animalYardRequired","animalAffectionate","animalApartment","animalCratetrained","animalDrools","animalEagerToPlease","animalEscapes","animalEventempered","animalFetches","animalGentle","animalGoodInCar","animalGoofy","animalHasAllergies","animalHearingImpaired","animalHypoallergenic","animalIndependent","animalIntelligent","animalLap","animalLeashtrained","animalNeedsCompanionAnimal","animalNoCold","animalNoFemaleDogs","animalNoHeat","animalNoLargeDogs","animalNoMaleDogs","animalNoSmallDogs","animalObedient","animalOKForSeniors","animalOKWithFarmAnimals","animalOlderKidsOnly","animalOngoingMedical","animalPlayful","animalPlaysToys","animalPredatory","animalProtective","animalSightImpaired","animalSkittish","animalSpecialDiet","animalSwims","animalTimid","fosterEmail","fosterFirstname","fosterLastname","fosterName","fosterPhoneCell","fosterPhoneHome","fosterSalutation","locationAddress","locationCity","locationCountry","locationUrl","locationName","locationPhone","locationState","locationPostalcode","animalPictures","animalVideos","animalVideoUrls"
]

}

}

Given what i know this request should return the exact same results if filter processing is set to "1 and 2 and 3". Unfortunately, it returns this:

{
"status": "ok",
"messages": {
"generalMessages": [],
"recordMessages": []
},
"foundRows": 0,
"data": []
}

This is an issue in my use case because I am hoping to make complex queries (example size is small OR medium and distance is within 25 miles of zip)

In this case the filters would look like so (example):

"filters":
[
{
"fieldName": "animalGeneralSizePotential",
"operation": "equals",
"criteria": "Small"
},
			{
"fieldName": "animalGeneralSizePotential",
"operation": "equals",
"criteria": "Medium"
},
{
"fieldName": "animalLocationDistance",
"operation": "radius",
"criteria": "25"
},
{
"fieldName": "animalLocation",
"operation": "equals",
"criteria": "20715"
}
],

And the filter processing would look something like this:

"filterProcessing": "(1 or 2) and 3 and 4",

Unfortunately with the issue with animal location distance and animal location this returns 0 records again. 

This issue only occurs when using the animalLocationDistance filter. So far every other combination of complex filters has worked properly.

Am I missing an issue in my query building or is this a known issue?

If this is a known issue are there any current solutions to help retrieve the correct results?


Thanks and Best Regards,

Katie

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Katie,

      Just a quick answer to hopefully help you.  I can look more into this and get back to you with a more detailed response if necessary.

      Although it's very odd behavior, the animaLocation and animalLocationDistance are not part of the filters.  Basically, you can ignore them when you try to use the filterProcessing.

      In your second example, you should use:

      "filterProcessing": "(1 or 2)"

      Hope this helps.  If not, please let us know and I'll look into it further.

      Richard

      1. Katie Cox

        I will run some tests and then post results. Thank you

      CommentAdd your comment...