Open eukreign opened 4 years ago
Looks roughly good to me. Some comments/thoughts:
xxx_metadata
rather than just metadata
since unlabeled metadata
is frequently assumed to be claim metadata. claim_search
and claim_search_features
rather than new top-level naming? And with some sort of design that supports somewhat seamlessly using the plugin when possible, otherwise falling back? Ideally, if lbry-desktop
is updated to use claim_search
always, it should work regardless of whether connected to a wallet server with a search plugin or not. It's okay if search works less well, but we'd like to find a design where this doesn't break.metadata
is specific to the search service, for example, if we move trending out of the SDK and into a search service then the search service may want to provide some extra information about the trending of a particular claim, or if full text search was used there may be some relevancy decimal for each of the result rows, etc. The SDK will simply just pass this down to the client, so search service can put whatever it wants in there. This field is totally optional and the search service may opt to have no extra metadata (therefore its results will just be claim_ids).claim_search
as a binary protobuf protocol which returns txid:nouts
(there aren't even claim_ids in that response). I think it's already confusing as it is with SDK having two completely different incompatible claim_search
APIs (one local used by app and one on wallet server used by client SDK), I'm not sure having a 3rd API end point named the same will help things. But having said that I don't feel too strongly about the name, if there is broader consensus to name the RPC function in lighthouse claim_search
and claim_search_features
i'd be happy to update this issue.
In order to improve the content discovery and search capabilities of the LBRY network the SDK needs a way to use 3rd party search services.
Version 1 of the proposed API will be JSON RPC to aid in development and debugging, once the design has proven itself in practice and the data structures exchanged have solidified we may consider switching to a binary protocol such as protobufs.
SDK will require two end points exposed by a search service in order to be compatible; they are described below:
search_features
This end point will only be called once on SDK startup to find out the features offered by the search service. Expected response string values with brackets are meant to be filled in:
Request: Plain
GET
with no arguments. Response:id
: SDK will use the{id}-{version}-{hash(configuration)}
to uniquely identify a search service internally.name
: potentially could be displayed in a UI where user can pick from several search servicesconfiguration
: SDK does not expect any structure for this, it's mostly informational and will be passed to clients as-is, it may be used for A/B testing or other metricsfilter
: SDK will enforce that client doing searches only use these filters,constraints
may be left off and defaults to just exact equality comparison,comparison
means that values will be in the format of ">332", "=<32", etc andfts
would mean that this field can support advanced full text search operations, etc.range
takes comma delimited values for high, low values "39,22"order_by
: SDK will enforce that for client requestsmetadata
: additional metadata search service provides ontop of what the SDK includes in the standard search responses already (for example, this may be some full-text-search metrics or content trending information, etc), it will simply be passed to clients as-issearch
This end point performs the actual search. It accepts a request with filters, order_by and pagination parameters (limit and offset) and responds with claims_ids and any extra metadata.
Request:
Response:
Work Flow
search_features
and cache the result for the duration of the running process.search_features
.claim_search
requests from clients it will validate that the filter fields and order_by fields are accepted by the search service.offset
value and send another search request, it will continue to request search and verify result against block/filter lists until either search service no longer returns claims or until thepage_size
requested by client has been filled up.