nationalparkservice / nps-api-samples

Sample Code using calls to the NPS API
32 stars 9 forks source link

Use of 'q' parameter unclear and seems inconsistent #3

Open RodBarnes opened 1 year ago

RodBarnes commented 1 year ago

Below is one example but I've seen this same behavior in every use of the q parameter. A request for all Parks that have the Activity "Dog Sledding" results in a result set of 36 Parks, many of which do not have "Dog Sledding" in their Activities. https://developer.nps.gov/api/v1/parks?start=0&limit=700&q=activity%3DDog%20Sledding

The first site returned -- Aleutian Islands World War II National Historic Area -- seems like one that would have that Activity but it is not in the list:

      "activities": [
        {
          "id": "B33DC9B6-0B7D-4322-BAD7-A13A34C584A3",
          "name": "Guided Tours"
        },
        {
          "id": "A0631906-9672-4583-91DE-113B93DB6B6E",
          "name": "Self-Guided Tours - Walking"
        },
        {
          "id": "C7D5A145-F8EB-4C37-9E92-2F6C6206B196",
          "name": "Self-Guided Tours - Auto"
        },
        {
          "id": "DF4A35E0-7983-4A3E-BC47-F37B872B0F25",
          "name": "Junior Ranger Program"
        },
        {
          "id": "0B685688-3405-4E2A-ABBA-E3069492EC50",
          "name": "Wildlife Watching"
        },
        {
          "id": "5A2C91D1-50EC-4B24-8BED-A2E11A1892DF",
          "name": "Birdwatching"
        },
        {
          "id": "C8F98B28-3C10-41AE-AA99-092B3B398C43",
          "name": "Museum Exhibits"
        }
      ],

I've tried q=activity%3DDog%20Sledding returns 36 q=activities%3DDog%20Sledding returns 42 q=Dog%20Sledding returns 13

Though all include that first entry -- Aleutian Islands World War II National Historic Area -- despite that it does not list "Dog Sledding" in the Activities or any where else in its data record.

I've downloaded the entire Parks.json (for testing and research), and a text search of that content finds only 4 sites that have the Activity "Dog Sledding":

            "id": "EE1F4878-00FB-4760-A77F-EA76DB8DEFD9",
            "fullName": "Bering Land Bridge National Preserve",

            "id": "C0BF2A42-E353-4FAE-B4C4-AA0676B58100",
            "fullName": "Denali National Park & Preserve",

            "id": "11E73438-0CCC-4441-A76A-1995F67F2D89",
            "fullName": "Kenai Fjords National Park",

            "id": "6F550E4D-AE26-4250-A674-397E2DF88092",
            "fullName": "Yukon - Charley Rivers National Preserve",
RodBarnes commented 1 year ago

UPDATE: Further testing seems to indicate that the q parameter is a full text search? But, even then, in my example of "Dog Sledding" the "Aleutian Islands World War II National Historic Area" site comes up and it contains neither of the words "Dog" or "Sledding" anywhere in the record.