--- title: Indexer keywords: fastai sidebar: home_sidebar nb_path: "nbs/indexers.indexer.ipynb" ---
When we run an indexer we have four steps. 1) Get the indexer and indexer run based on the run id. 2) run the indexer 3) populate the graph with the new information. To mock that, first we create a client and add some toy data.
client = PodClient()
def create_toy_dataset(client):
location = Location.from_data(latitude=-37.81, longitude=144.96)
address = Address.from_data()
indexer = Indexer.from_data(pluginClass="GeoIndexer", name="GeoIndexer")
indexer_run = IndexerRun.from_data(progress=0, targetDataType="Address")
for x in [location, address, indexer, indexer_run]: client.create(x)
assert client.create_edge(Edge(indexer_run, indexer, "indexer"))
assert client.create_edge(Edge(location, address, "location"))
return indexer, indexer_run, location, address
Now we start with the setting we would normally have: some memri client makes a call to the pod to execute an indexer run. Lets start by getting the indexer and the indexer run.
# id = indexer_run.id; id
# indexer = indexer_run.indexer[0]
# indexer
Next, we retrieve the data, which was specified in the client by the targetDataType
.
# data
# run_integrator(pod_full_address=DEFAULT_POD_ADDRESS,
# integrator_run_id=indexer_run.id,
# database_key=client.database_key,
# owner_key=client.owner_key)
# client.delete_all()
All indexers need to be registred before they can be ran. We can test our registration as follows
{% include important.html content='Note that before running an indexer, it needs to be registered. We can do this by importing the file in integrators.indexer_registry.py
.' %}