<s>[INST] We build a new social network called "Chatter".
Chatter will allow users to send and receive messages, as well as search for other users and view their profiles.
Develop the algorithm for searching for users.

Here are the requirements:

* The search should return users whose name or email contains the search query
* The search should be case-insensitive
* The search should return users in the order of relevance, with users whose name or email exactly matches the search query appearing first, followed by users whose name or email contains the search query as a substring
* The search should return at most 10 results

Here is an example of how the data model for a user might look:
```
class User:
    def __init__(self, id, name, email):
        self.id = id
        self.name = name
        self.email = email
```
And here is an example of how the list of all registered users might look:
```
users = [
    User(1, "John Doe", "johndoe@example.com"),
    User(2, "Jane Doe", "janedoe@example.com"),
    User(3, "John Smith", "johnsmith@example.com"),
    User(4, "Jane Smith", "janesmith@example.com"),
    ...
]
```

How would you design the algorithm for searching for users?[/INST]