---
# System prepended metadata

title: Focus query updates updates

---

# Focus query updates updates

1. Search query
2. Entity details
3. Person details
4. Wallet details


## Entity search query (for top left searchbar)

```
CALL
	db.index.fulltext.queryNodes("focusSearch", $query)
yield node, score
with 
    node, 
    score
match
    (node)
optional match
    (node)-[]-(t:Twitter)
optional match
    (node)-[]-(w:Website)
with 
    node.name as name,
    tostring(id(node)) as id,
    t.bio as twitter_bio,
    node.profileUrl as snapshotImage,
    t.followerCount as followerCount,
    t.profileImageUrl as twitterImage,
    [x in labels(node) where x in ['Person', Entity]] as labels
	score
limit 10
return distinct
{
    id: id,
    name: name,
    twitterBio: twitter_bio,
    twitterFollowers: followerCount,
    entityImage: snapshotImage,
    backupImage: twitterImage
    labels: labels,
    score: score
}

```
// if entity, use "entityImage". if no entity image, use "backupImage"
// if person, use "backupImage"




## Person details query

```
match 
    (n:Person)
where
    tostring(id(n)) = $ID
with 
    n
match
    (n:Person)
optional match
    (n)-[]->(alias:Alias)
optional match
    (n)-[t:HAS_ACCOUNT]->(twitter:Twitter)
optional match 
    (n)-[]->(wallet:Wallet)
optional match
    (n)-[]->(wallet:Wallet)-[]-(e:Ens)
optional match
    (n)-[r:TRUST]-(trusted)
with 
    n.name as name,
    collect(distinct(alias.name)) + collect(distinct(e.name)) as aliases,
    t.bio as description,
    twitter.followerCount as twitterFollowers,
    collect(distinct(wallet.address)) as wallets,
    count(distinct(trusted)) as trusted_entities,
    n.uuid as uuid,
    tostring(id(n)) as id
return
    {
        uuid: uuid,
        id: id,
        name: name,
        aliases: aliases,
        description: description,
        twitterFollowers: twitterFollowers,
        wallets: wallets,
        trustedEntities: trusted_entities
    } as result    
```


## Entity details query

```
match
    (n:Entity)
where 
    tostring(id(n)) = $ID
with 
    n 
match
    (n:Entity)
optional match
    (n)-[]->(alias:Alias)
optional match
    (n)-[t:HAS_ACCOUNT]->(twitter:Twitter)
optional match 
    (n)-[strategy:HAS_STRATEGY]->(token:Token)
optional match
    (n)-[:TRUST]-(trusted)
with 
    n,
    n.name as name,
    n.uuid as uuid,
    twitter.bio as bio,
    twitter.followerCount as twitterFollowers,
    collect(distinct(alias.name)) as aliases,
    "https://twitter.com/" + twitter.handle as twitterProfileUrl,
    token,
    n.profileUrl as profileImage,
    tostring(id(n)) as id,
    t.profileImageUrl as backupImage,
    n.snapshotId as snapshotId,
    'https://etherscan.io/token/' + token.address as tokenLink,
    'https://snapshot.org/#/' + n.snapshotId as snapshotLink,
    count(distinct(trusted)) as trusted_ents
return 
    {
        uuid: uuid,
        id: id,
        name: name,
        description: bio,
        twitterFollowersCount: twitterFollowers,
        twitterProfileUrl: twitterProfileUrl,
        snapshotLink: snapshotLink,
        tokenLink: tokenLink,
        countTrusted: trusted_ents,
        profileImage: profileImage,
        backupProfileImage: backupImage
    } as result
  ```
    

## Wallet details query

```
match 
    (w:Wallet)
where
    w.address = '0xc75446a6adaef73269dbdece73536977b2b639e0'
with 
    w
optional match
    (w)-[]-(e:Ens)
optional match
    (w)-[r:TRUST]-(t)
where
    w.address = $wallet_address
with 
    w,
    "https://etherscan.com/address/" + w.address as etherscan_link,
    collect(distinct(e.name)) as ens_names,
    w.uuid as uuid,
    tostring(id(w)) as id,
    w.address as address,
    count(distinct(r)) as trusted_entities
return
    {
    return
    {
        uuid: uuid,
        id: id,
        address: address,
        ens_names: ens_names,
    } as result    
```
