<jupyter_start><jupyter_text>CRUD FunctionsFirst we look at basic CRUD operations. In Jina, CRUD corresponds to four functions: `index` (create), `search` (read), `update`, and `delete`. With documents below as example:<jupyter_code>#Run this command to install Jina in this notebook
!pip install jina[hub]
import numpy as np
from jina import Document

docs = [Document(id='🐲', embedding=np.array([0, 0]), tags={'guardian': 'Azure Dragon', 'position': 'East'}),
        Document(id='🐦', embedding=np.array([1, 0]), tags={'guardian': 'Vermilion Bird', 'position': 'South'}),
        Document(id='🐢', embedding=np.array([0, 1]), tags={'guardian': 'Black Tortoise', 'position': 'North'}),
        Document(id='🐯', embedding=np.array([1, 1]), tags={'guardian': 'White Tiger', 'position': 'West'})]<jupyter_output><empty_output><jupyter_text>Let's build a simple Flow with a simple indexer.<jupyter_code>from jina import Flow
f = Flow().add(uses='jinahub+docker://NumpyPostgresSearcher')<jupyter_output><empty_output><jupyter_text>`Document` and `Flow` are important concepts in Jina, which will be explained later. [NumpyPostgresSearcher](https://github.com/jina-ai/executor-indexers/tree/main/jinahub/indexers/searcher/compound/NumpyPostgresSearcher) is a built-in [compound vector-based searcher](https://github.com/jina-ai/executor-indexersjina-indexers) that stores embedding and structured info for similarity search.  IndexingThis will store four docs (both embedding and structured info) into Jina.<jupyter_code>with f:
    f.index(docs, on_done=print)<jupyter_output><empty_output><jupyter_text>SearchingThis will print 🐲🐦🐢 Doc with score 0, 1, 1, respectively, as these three documents are nearest neighbout of the query document.<jupyter_code>with f:
    f.search(docs[0], top_k=3,
             on_done=lambda x: [print(m.dict()) for m in x.docs[0].matches])<jupyter_output><empty_output><jupyter_text>UpdatingUpdate 🐲 embedding to `[1, 1]`<jupyter_code>docs[0].embedding = np.array([1, 1])
with f:
    f.update(docs[0])<jupyter_output><empty_output><jupyter_text>DeletingRemove 🐦🐲 Documents<jupyter_code>with f:
    f.delete(['🐦', '🐲'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1509433962264151, 'fraction_numerical': 0.009203865623561895, 'mean_word_length': 6.601398601398602, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '270091', 'license': 'Apache-2.0', 'n_tokens_mistral': 782, 'n_tokens_neox': 750, 'n_words': 181, 'path': 'basic-crud-functions.ipynb', 'repo_name': 'jina-ai/jupyter-notebooks', 'size': '2173'}