mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(api) API documentation
This commit is contained in:
parent
5d6e0e3790
commit
6bac3c75cb
@ -13,6 +13,7 @@ service IndexApi {
|
|||||||
|
|
||||||
message Empty {}
|
message Empty {}
|
||||||
|
|
||||||
|
/* Query Service query request */
|
||||||
message RpcQsQuery {
|
message RpcQsQuery {
|
||||||
string humanQuery = 1;
|
string humanQuery = 1;
|
||||||
string nearDomain = 2;
|
string nearDomain = 2;
|
||||||
@ -29,6 +30,7 @@ message RpcQsQuery {
|
|||||||
string searchSetIdentifier = 13;
|
string searchSetIdentifier = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Query service query response */
|
||||||
message RpcQsResponse {
|
message RpcQsResponse {
|
||||||
RpcIndexQuery specs = 1;
|
RpcIndexQuery specs = 1;
|
||||||
repeated RpcDecoratedResultItem results = 2;
|
repeated RpcDecoratedResultItem results = 2;
|
||||||
@ -37,20 +39,22 @@ message RpcQsResponse {
|
|||||||
string domain = 5;
|
string domain = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Index service query request */
|
||||||
message RpcIndexQuery {
|
message RpcIndexQuery {
|
||||||
repeated RpcSubquery subqueries = 1;
|
repeated RpcSubquery subqueries = 1;
|
||||||
repeated int32 domains = 2;
|
repeated int32 domains = 2; // (optional) A list of domain IDs to consider
|
||||||
string searchSetIdentifier = 3;
|
string searchSetIdentifier = 3; // (optional) A named set of domains to consider
|
||||||
string humanQuery = 4;
|
string humanQuery = 4; // The search query as the user entered it
|
||||||
RpcSpecLimit quality = 5;
|
RpcSpecLimit quality = 5;
|
||||||
RpcSpecLimit year = 6;
|
RpcSpecLimit year = 6;
|
||||||
RpcSpecLimit size = 7;
|
RpcSpecLimit size = 7;
|
||||||
RpcSpecLimit rank = 8;
|
RpcSpecLimit rank = 8;
|
||||||
RpcQueryLimits queryLimits = 9;
|
RpcQueryLimits queryLimits = 9;
|
||||||
string queryStrategy = 10;
|
string queryStrategy = 10; // Named query configuration
|
||||||
RpcResultRankingParameters parameters = 11;
|
RpcResultRankingParameters parameters = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A tagged union encoding some limit on a field */
|
||||||
message RpcSpecLimit {
|
message RpcSpecLimit {
|
||||||
int32 value = 1;
|
int32 value = 1;
|
||||||
TYPE type = 2;
|
TYPE type = 2;
|
||||||
@ -63,10 +67,7 @@ message RpcSpecLimit {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
message RpcSearchResultSet {
|
/** A search result item decorated with title and description metadata from the link database */
|
||||||
repeated RpcDecoratedResultItem items = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RpcDecoratedResultItem {
|
message RpcDecoratedResultItem {
|
||||||
RpcRawResultItem rawItem = 1;
|
RpcRawResultItem rawItem = 1;
|
||||||
string url = 2;
|
string url = 2;
|
||||||
@ -74,40 +75,43 @@ message RpcDecoratedResultItem {
|
|||||||
string description = 4;
|
string description = 4;
|
||||||
double urlQuality = 5;
|
double urlQuality = 5;
|
||||||
string format = 6;
|
string format = 6;
|
||||||
int32 features = 7;
|
int32 features = 7; // bitmask encoding features of the document
|
||||||
int32 pubYear = 8;
|
int32 pubYear = 8;
|
||||||
int64 dataHash = 9;
|
int64 dataHash = 9;
|
||||||
int32 wordsTotal = 10;
|
int32 wordsTotal = 10;
|
||||||
double rankingScore = 11;
|
double rankingScore = 11; // The ranking score of this search result item, lower is better
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A raw index-service view of a search result */
|
||||||
message RpcRawResultItem {
|
message RpcRawResultItem {
|
||||||
int64 combinedId = 1;
|
int64 combinedId = 1; // raw ID with bit-encoded ranking information still present
|
||||||
int32 resultsFromDomain = 2;
|
int32 resultsFromDomain = 2; // number of other results from the same domain
|
||||||
repeated RpcResultKeywordScore keywordScores = 3;
|
repeated RpcResultKeywordScore keywordScores = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Information about how well a keyword matches a query */
|
||||||
message RpcResultKeywordScore {
|
message RpcResultKeywordScore {
|
||||||
int32 subquery = 1;
|
int32 subquery = 1; // index of the subquery this keyword relates to
|
||||||
string keyword = 2;
|
string keyword = 2; // the keyword
|
||||||
int64 encodedWordMetadata = 3;
|
int64 encodedWordMetadata = 3; // bit encoded word metadata
|
||||||
int64 encodedDocMetadata = 4;
|
int64 encodedDocMetadata = 4; // bit encoded document metadata
|
||||||
bool hasPriorityTerms = 5;
|
bool hasPriorityTerms = 5; // true if this word is important to the document
|
||||||
int32 htmlFeatures = 6;
|
int32 htmlFeatures = 6; // bit encoded document features
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Query execution parameters */
|
||||||
message RpcQueryLimits {
|
message RpcQueryLimits {
|
||||||
int32 resultsByDomain = 1;
|
int32 resultsByDomain = 1;
|
||||||
int32 resultsTotal = 2;
|
int32 resultsTotal = 2;
|
||||||
int32 timeoutMs = 3;
|
int32 timeoutMs = 3;
|
||||||
int32 fetchSize = 4;
|
int32 fetchSize = 4; // Size of the fetch buffer in the index service
|
||||||
}
|
}
|
||||||
|
|
||||||
message RpcResultRankingParameters {
|
message RpcResultRankingParameters {
|
||||||
double fullK = 1;
|
double fullK = 1; // BM25 parameter
|
||||||
double fullB = 2;
|
double fullB = 2; // BM25 parameter
|
||||||
double prioK = 3;
|
double prioK = 3; // BM25 parameter
|
||||||
double prioB = 4;
|
double prioB = 4; // BM25 parameter
|
||||||
int32 shortDocumentThreshold = 5;
|
int32 shortDocumentThreshold = 5;
|
||||||
double shortDocumentPenalty = 6;
|
double shortDocumentPenalty = 6;
|
||||||
double domainRankBonus = 7;
|
double domainRankBonus = 7;
|
||||||
@ -122,18 +126,21 @@ message RpcResultRankingParameters {
|
|||||||
|
|
||||||
enum TEMPORAL_BIAS {
|
enum TEMPORAL_BIAS {
|
||||||
NONE = 0;
|
NONE = 0;
|
||||||
RECENT = 1;
|
RECENT = 1; // Prefer recent documents
|
||||||
OLD = 2;
|
OLD = 2; // Prefer older documents
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Defines a single subquery */
|
||||||
message RpcSubquery {
|
message RpcSubquery {
|
||||||
repeated string include = 1;
|
repeated string include = 1; // These terms must be present
|
||||||
repeated string exclude = 2;
|
repeated string exclude = 2; // These terms must be absent
|
||||||
repeated string advice = 3;
|
repeated string advice = 3; // These terms must be present, but do not affect ranking
|
||||||
repeated string priority = 4;
|
repeated string priority = 4; // These terms are not mandatory, but affect ranking positively if they are present
|
||||||
repeated RpcCoherences coherences = 5;
|
repeated RpcCoherences coherences = 5; // Groups of terms that must exist in proximity of each other
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Defines a group of search terms that must exist in close proximity within the document */
|
||||||
message RpcCoherences {
|
message RpcCoherences {
|
||||||
repeated string coherences = 1;
|
repeated string coherences = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user