Searching through MutableData


#1

I’m playing about with the SAFE web API, just trying to understand how everything works before I build my first app. I think I understand the basics of how it works (haven’t quite got to permissions yet or the encryption stuff).

So I can use the newPublic endpoint to create/get a reference to my data, then I can query it using getEntries and forEach docs.maidsafe .net/beaker-plugin-safe-app/#windowsafemutabledataentriesforeach.

But my question is around searching through data. If I was to make a very simple app like Twitter, where people post public MutableData and in the end I have 1000 entries. How could I search for an entry that contains a specific phrase.

Would I need to implement some sort of indexing then loop through the keys/values to find the record I want. Or will there be a query api.

It sort of links in with another question I have about pagination, limiting records, etc. I might be thinking too “traditional app” in my approach so sorry if these are really stupid questions.


#2

This would not be a very simple app really. It would be incredibly fast changing mass subscription (pub/sub) type application. The network will not handle that well at all at the moment. Maybe you should think about a simple app, like a password manager, web site builder, youtube, messaging, collaboration tool etc. to get started ?


#3

Yeah, actually I was thinking of creating a small messaging demo. Although the same issue will arise when we have thousands of chat messages, and have to fetch them all back even if I only want to see the last 10?

Is there a way for me to do something like getEntries but the last X rows?


#4

I am not sure, the front end guys will help there. However there are many options for data tore and retrieve, you can keep chat messages in Immutable chunks etc. or Mutable Data elements, its all design really. I know I am not helping much, but its perhaps good to consider the options there. For instance store previous messages in NOSQL immutable structures or similar. You can use a mix of MD and ID types as well.

Sorry I am working on another part right now, you will get help though, the front end guys will be along soon I imagine :wink: