Repository: oceanprotocol/ocean.py (language: python)

Issue:
Create README: add label to asset; search & filter by label
There are several use cases where we want to retrieve data NFTs (or datatokens) by searching across all of them, and filtering down by label.

This should be easy for ocean.py users to figure out.

TODO for this issue: add a README where the user:
- creates a few data assets. Each asset has >= 1 labels
- searches & finds the assets by filtering by label

Potentially helpful resources:
- [df-py "Filter non-market assets" PR](https://github.com/oceanprotocol/df-py/pull/292) uses the patterns that we can use here.
- Base resource: https://docs.oceanprotocol.com/core-concepts/did-ddo 
- Another example: [https://1520763098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzQl[…]23f36dcef441e8fd76fdf6b6%2Fddo-flow%20(1).png?alt=media](https://1520763098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzQlpIJEeu8x5yl0OLuXn%2Fuploads%2Fgit-blob-fab9a027b0a25d4023f36dcef441e8fd76fdf6b6%2Fddo-flow%20(1).png?alt=media)


Discussion / hints:
what's a "label"? We have `tags` & `categories` so which one is it? https://docs.oceanprotocol.com/core-concepts/did-ddo#metadata
Either one. "Tag" is best. 

(If you ask me we should deprecate "category" because it's a subset of "tag", and its boundaries are fuzzy. But that's another story.) 

Fix patch:
diff --git a/READMEs/search-and-filter-assets.md b/READMEs/search-and-filter-assets.md
new file mode 100644
index 000000000..1fe0e311a
--- /dev/null
+++ b/READMEs/search-and-filter-assets.md
@@ -0,0 +1,84 @@
+<!--
+Copyright 2022 Ocean Protocol Foundation
+SPDX-License-Identifier: Apache-2.0
+-->
+
+
+# Quickstart: Search Assets Flow
+
+This quickstart describes how assets can be found by their `tags` from Aquarius.
+
+
+Here are the steps:
+
+1.  Setup
+2.  Alice creates few assets for testing
+3.  Alice searches & filters assets by their `tags`
+
+Let's go through each step.
+
+## 1. Setup
+
+From [data-nfts-and-datatokens-flow](data-nfts-and-datatokens-flow.md), do:
+- [x] Setup : Prerequisites
+- [x] Setup : Download barge and run services
+- [x] Setup : Install the library
+- [x] Setup : Set envvars
+- [x] Setup : Setup in Python
+
+
+## 2. Alice publishes datasets
+
+Now, you're Alice. Using [publish-flow](publish-flow.md) model, do:
+
+```python
+#data info
+name = "Branin dataset"
+url = "https://raw.githubusercontent.com/trentmc/branin/main/branin.arff"
+
+# Created a list of tags for the following assets
+tags = [
+    ["test", "ganache", "best asset"],
+    ["test", "ocean"],
+    ["AI", "dataset", "testing"],
+]
+# Publish few assets for testing
+for tag in tags:
+    (data_NFT, datatoken, asset) = ocean.assets.create_url_asset(name, url, alice_wallet)
+    print(f"Just published asset, with did={asset.did}")
+    
+    # Update the metadata introducing `tags`
+    asset.metadata.update({"tags": tag})
+    asset = ocean.assets.update(asset=asset, publisher_wallet=alice_wallet, provider_uri=config["PROVIDER_URL"])
+    print(f"Just updated the metadata of the asset with did={asset.did}.")
+
+```
+## 3. Alice filters assets by their `tags`
+
+Alice can filter the assets by a certain tag and after can retrieve the necessary
+information afterwards.
+
+```python
+# Get a list of assets filtered by a given tag.
+# All assets that contain the specified tag name
+tag = "test"
+all_assets = ocean.assets.search(tag)
+
+# Filter just by the `tags` key
+filtered_assets = list(
+    filter(
+        lambda a: tag in a.metadata["tags"],
+        list(filter(lambda a: "tags" in a.metadata.keys(), all_assets)),
+    )
+)
+
+# Make sure that the provided tag is valid.
+assert len(filtered_assets) > 0, "Assets not found with this tag."
+
+# Retrieve the wanted information from assets.
+for asset in filtered_assets:
+    print(f"asset.did :{asset.did}")
+    print(f"asset.metadata :{asset.metadata}")
+    print(f"asset.nft :{asset.nft}")
+    print(f"asset.datatokens :{asset.datatokens}")
+```
\ No newline at end of file


Test patch:
diff --git a/tests/readmes/test_readmes.py b/tests/readmes/test_readmes.py
index 7d38853ac..c813fbbe6 100644
--- a/tests/readmes/test_readmes.py
+++ b/tests/readmes/test_readmes.py
@@ -44,6 +44,7 @@ def test_script_execution(script, monkeypatch):
         "key-value-flow",
         "profile-nfts-flow",
         "consume-flow",
+        "search-and-filter-assets",
     ]
 
     globs = {}