3

You can find all datasets in a socrata site like this:

/data/?tags=parking

How can you find datasets that match one of several tags (OR)? This doesn't work:

/data/?tags=parking&tags=footpaths
2

This undocumented method seems to get really close:

/data?search=tags%3Aparking+OR+tags%3Afootpath

That is, you can search for "tags:parking OR tags:footpath". It's "close" because Socrata applies stemming, so it also finds datasets with tags such as "park", but it ranks exact matches higher.

It seems that Socrata has removed boolean queries from more recent deployments, however.

1

I'm guessing tags are comma separated, because This search returns results with parking and sensors tags: https://data.melbourne.vic.gov.au/data?tags=parking,sensors
Didn't use your example, because there is only one set tagged with footpaths, and it doesn't also have a parking tag.

EDIT: comma separated doesn't do SQL's OR, but adding &OR between tag declarations seems to work, like so https://data.melbourne.vic.gov.au/data?tags=parking&OR&tags=sensors

EDIT Two:
this solution shows only sets matching all requirements, not all sets with one requirement. solution provided by @Steve Bennett is the desired OR solution.

  • 1
    Ok, it's good to know that you can do an AND query with a comma. I'm looking for an OR query though. – Steve Bennett Oct 4 '16 at 6:13
  • not sure how i missed that....my bad – albert Oct 4 '16 at 11:01
  • 1
    That &OR& method doesn't seem to work. There are 7 datasets tagged "parking", so combining that with sensors should yield more than that. This works better: data.melbourne.vic.gov.au/… – Steve Bennett Oct 4 '16 at 22:27
  • 1
    ha, i completely misread the SQL OR statement definition, apologies – albert Oct 5 '16 at 0:57
1

No need to use the secret parameters on our /data.json feed, you can actually use our actually-not-secret Discovery API now!: http://docs.socratadiscovery.apiary.io/#reference/0/searching-particular-categoriestags/category/tag-search-api

Edit: I now understand better what you're looking for. I thought you were looking for an API, but it really looks like you're just looking for options for our data catalog interface.

The tags parameter can be repeated on that page to AND together multiple tags. Does that do the job?

https://data.seattle.gov/browse?tags=crime&tags=police%20report

  • any documentation for said secret parameters? – albert Oct 5 '16 at 21:45
  • Hmm, that's just the API though. In this instance I'm looking for a publicly shareable URL that would resolve to a human-readable search results page. So not so useful in this particular case. – Steve Bennett Oct 7 '16 at 3:11
  • 1
    @albert I'd recommend you use the Discovery API instead. It's got more search options and is officially supported – chrismetcalf Oct 11 '16 at 1:14
  • so yes there is documentation its just internal and you don't want word to get out? – albert Oct 11 '16 at 1:29
  • 1
    @albert The way the /browse or /data catalogs can be filtered is dependent on how that particular customer's site is configured. But they're powered by the Discovery API, so I'd start there to get an idea how they work, or just use the Discovery API directly. – chrismetcalf Oct 11 '16 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.