Skip to content

Commit 624920f

Browse files
committed
Search API added.
1 parent 4f521c3 commit 624920f

664 files changed

Lines changed: 3225 additions & 2577 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_data/node_api.yml

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ objects:
768768
<br><br>
769769
The node may decide to return fewer contacts than the given <code>limit</code>.
770770
<br><br>
771-
The contacts are sorted by their <i>closeness</i> to the node, which is calculated from the number of
772-
reactions and comments and their age.
771+
The contacts are sorted by <i>social distance</i> from the node, which depends on their subscription and
772+
friendship status and the number of recent reactions and comments.
773773
errors:
774774
- code: limit.invalid
775775
description: <code>limit</code> parameter has an invalid value
@@ -2757,6 +2757,38 @@ objects:
27572757
description: sheriff's order is not found
27582758
- code: sheriff-order.wrong-node
27592759
description: the sheriff's order is related to a different node
2760+
- name: Search
2761+
description: >
2762+
Search API is implemented by nodes acting as search engines in the Moera network.
2763+
requests:
2764+
- url: /search/nodes
2765+
type: GET
2766+
function: searchNodes
2767+
query:
2768+
- type: String
2769+
name: query
2770+
optional: true
2771+
description: the search query
2772+
- type: int
2773+
name: limit
2774+
optional: true
2775+
description: maximum number of nodes returned
2776+
out:
2777+
struct: SearchNodeInfo
2778+
array: true
2779+
auth: optional
2780+
description: >
2781+
Search for Moera nodes matching the search <code>query</code>. Every space-delimited word in the query must
2782+
match case-insensitively a beginning of the node's name or a beginning of any non-letter-delimited word in
2783+
the node's full name. The order of words is not significant.
2784+
<br><br>
2785+
The search engine may decide to return fewer nodes than the given <code>limit</code>.
2786+
<br><br>
2787+
The returned nodes are sorted by their relevance. The exact definition of this term is left to the search
2788+
engine's implementation.
2789+
errors:
2790+
- code: limit.invalid
2791+
description: <code>limit</code> parameter has an invalid value
27602792
- name: Settings
27612793
description: >
27622794
Settings - the node and client settings. The node settings affect the node behavior. Only those settings are
@@ -3081,6 +3113,8 @@ objects:
30813113
description: there is no posting with the given ID
30823114
- code: user-list.not-found
30833115
description: there is no list of users with the given name
3116+
- code: subscriber.too-many
3117+
description: there are too many subscribers of this type
30843118
- url: /people/subscribers/{id}
30853119
type: GET
30863120
function: getSubscriber
@@ -4489,10 +4523,10 @@ structures:
44894523
name: avatar
44904524
optional: true
44914525
- type: float
4492-
name: closeness
4526+
name: distance
44934527
description: >
4494-
closeness of the contact to the node, which is calculated from the number of reactions and comments and
4495-
their age
4528+
social distance between the contact and the node, which depends on subscription and friendship status and
4529+
the number recent reactions and comments
44964530
- type: boolean
44974531
name: hasFeedSubscriber
44984532
optional: true
@@ -6690,6 +6724,25 @@ structures:
66906724
- type: String
66916725
name: sheriffName
66926726
description: name of the sheriff that added the mark
6727+
- name: SearchNodeInfo
6728+
fields:
6729+
- type: String
6730+
name: nodeName
6731+
- type: String
6732+
name: fullName
6733+
optional: true
6734+
description: node owner's full name
6735+
- type: String
6736+
name: title
6737+
optional: true
6738+
description: node title
6739+
- struct: AvatarImage
6740+
name: avatar
6741+
optional: true
6742+
description: node owner's avatar
6743+
- type: float
6744+
name: distance
6745+
description: social distance between the node and the client
66936746
- name: SettingInfo
66946747
fields:
66956748
- type: String
@@ -7776,9 +7829,6 @@ structures:
77767829
name: reason
77777830
optional: true
77787831
description: subscription reason
7779-
constraints:
7780-
- notnull:
7781-
error: subscription.reason.missing
77827832
- struct: SubscriptionOperations
77837833
name: operations
77847834
optional: true
@@ -8434,6 +8484,22 @@ enums:
84348484
- name: all
84358485
description: all permissions
84368486
value: "0x3fffffff"
8487+
- name: SearchContentUpdateType
8488+
values:
8489+
- name: block
8490+
description: the node was blocked
8491+
- name: friend
8492+
description: the node was added to the list of friends
8493+
- name: profile
8494+
description: the profile was updated
8495+
- name: subscribe
8496+
description: subscribed to the node
8497+
- name: unblock
8498+
description: the node was unblocked
8499+
- name: unfriend
8500+
description: the node was removed from the list of friends
8501+
- name: unsubscribe
8502+
description: unsubscribed from the node
84378503
- name: SearchEngine
84388504
values:
84398505
- name: google
@@ -8692,14 +8758,22 @@ enums:
86928758
values:
86938759
- name: feed
86948760
description: subscribe to new stories in the feed
8761+
ordinal: 0
86958762
- name: posting
86968763
description: subscribe to updates to the posting
8764+
ordinal: 1
86978765
- name: posting-comments
86988766
description: subscribe to new comments to the posting
8767+
ordinal: 2
86998768
- name: profile
87008769
description: subscribe to updates to the node profile
8770+
ordinal: 3
8771+
- name: search
8772+
description: subscribe to updates to all content that may be indexed by a search engine
8773+
ordinal: 5
87018774
- name: user-list
87028775
description: subscribe to updates to the user list (its name is passed in <code>feedName</code> field)
8776+
ordinal: 4
87038777
- name: VerificationStatus
87048778
values:
87058779
- name: running

_data/notifications.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,45 @@ notifications:
11821182
- struct: AvatarImage
11831183
name: commentOwnerAvatar
11841184
comment: avatar of the comment owner
1185+
- type: SEARCH_CONTENT_UPDATED
1186+
ordinal: 36
1187+
description: >
1188+
Notification sent to a Moera search engine when some content on the node was updated and needs reindexing.
1189+
fields:
1190+
- type: String
1191+
name: subscriberId
1192+
comment: subscriber ID of the receiving node on the sending node
1193+
constraints:
1194+
- length:
1195+
max: 40
1196+
error: subscriber.subscriber-id.wrong-size
1197+
log: true
1198+
- enum: SearchContentUpdateType
1199+
name: updateType
1200+
comment: type of the content that was updated
1201+
constraints:
1202+
- notnull:
1203+
error: search.update-type.missing
1204+
log: true
1205+
- type: String
1206+
name: nodeName
1207+
comment: name of the node; the concrete meaning depends on the update type
1208+
constraints:
1209+
- length:
1210+
max: 40
1211+
error: search.node-name.wrong-size
1212+
log: true
1213+
- type: String
1214+
name: feedName
1215+
comment: name of the feed; used by subscription/unsubscription updates
1216+
constraints:
1217+
- length:
1218+
max: 63
1219+
error: search.feed-name.wrong-size
1220+
log: true
1221+
- enum: BlockedOperation
1222+
name: blockedOperation
1223+
comment: the operation being blocked/unblocked; used by updates about blocking/unblocking
11851224
- type: SEARCH_ENGINE_CLICKED
11861225
ordinal: 35
11871226
description: The receiver's posting/comment/media has been visited on the sending node from a search engine.

_data/py_node_api.yml

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,22 @@ enums:
202202
- description: all permissions
203203
name: all
204204
value: '0x3fffffff'
205+
- name: SearchContentUpdateType
206+
values:
207+
- description: the node was blocked
208+
name: block
209+
- description: the node was added to the list of friends
210+
name: friend
211+
- description: the profile was updated
212+
name: profile
213+
- description: subscribed to the node
214+
name: subscribe
215+
- description: the node was unblocked
216+
name: unblock
217+
- description: the node was removed from the list of friends
218+
name: unfriend
219+
- description: unsubscribed from the node
220+
name: unsubscribe
205221
- name: SearchEngine
206222
values:
207223
- description: Google
@@ -458,15 +474,24 @@ enums:
458474
values:
459475
- description: subscribe to new stories in the feed
460476
name: feed
477+
ordinal: 0
461478
- description: subscribe to updates to the posting
462479
name: posting
480+
ordinal: 1
463481
- description: subscribe to new comments to the posting
464482
name: posting-comments
483+
ordinal: 2
465484
- description: subscribe to updates to the node profile
466485
name: profile
486+
ordinal: 3
487+
- description: subscribe to updates to all content that may be indexed by a search
488+
engine
489+
name: search
490+
ordinal: 5
467491
- description: subscribe to updates to the user list (its name is passed in <code>feedName</code>
468492
field)
469493
name: user-list
494+
ordinal: 4
470495
- name: VerificationStatus
471496
values:
472497
- description: the verification is pending
@@ -1310,8 +1335,9 @@ objects:
13101335
of the contact''s node name or a beginning of any space-delimited word in the
13111336
contact''s full name. The order of words is not significant. <br><br> The node
13121337
may decide to return fewer contacts than the given <code>limit</code>. <br><br>
1313-
The contacts are sorted by their <i>closeness</i> to the node, which is calculated
1314-
from the number of reactions and comments and their age.
1338+
The contacts are sorted by <i>social distance</i> from the node, which depends
1339+
on their subscription and friendship status and the number of recent reactions
1340+
and comments.
13151341
13161342
'
13171343
errors:
@@ -3119,6 +3145,38 @@ objects:
31193145
- description: ID of the order
31203146
name: id
31213147
type: str
3148+
- description: 'Search API is implemented by nodes acting as search engines in the
3149+
Moera network.
3150+
3151+
'
3152+
name: Search
3153+
requests:
3154+
- auth: optional
3155+
description: 'Search for Moera nodes matching the search <code>query</code>. Every
3156+
space-delimited word in the query must match case-insensitively a beginning
3157+
of the node''s name or a beginning of any non-letter-delimited word in the node''s
3158+
full name. The order of words is not significant. <br><br> The search engine
3159+
may decide to return fewer nodes than the given <code>limit</code>. <br><br>
3160+
The returned nodes are sorted by their relevance. The exact definition of this
3161+
term is left to the search engine''s implementation.
3162+
3163+
'
3164+
errors:
3165+
- code: limit.invalid
3166+
description: <code>limit</code> parameter has an invalid value
3167+
function: search_nodes(query=None, limit=None)
3168+
out:
3169+
array: true
3170+
struct: SearchNodeInfo
3171+
params:
3172+
- description: the search query
3173+
name: query
3174+
optional: true
3175+
type: str
3176+
- description: maximum number of nodes returned
3177+
name: limit
3178+
optional: true
3179+
type: int
31223180
- description: 'Settings - the node and client settings. The node settings affect
31233181
the node behavior. Only those settings are accepted that are known by the node,
31243182
and their values are validated before saving. The node settings metadata can be
@@ -3423,6 +3481,8 @@ objects:
34233481
description: there is no posting with the given ID
34243482
- code: user-list.not-found
34253483
description: there is no list of users with the given name
3484+
- code: subscriber.too-many
3485+
description: there are too many subscribers of this type
34263486
function: create_subscriber(subscriber)
34273487
out:
34283488
struct: SubscriberInfo
@@ -5113,11 +5173,11 @@ structures:
51135173
- name: avatar
51145174
optional: true
51155175
struct: AvatarImage
5116-
- description: 'closeness of the contact to the node, which is calculated from the
5117-
number of reactions and comments and their age
5176+
- description: 'social distance between the contact and the node, which depends
5177+
on subscription and friendship status and the number recent reactions and comments
51185178
51195179
'
5120-
name: closeness
5180+
name: distance
51215181
type: float
51225182
- description: the contact is subscribed to at least one of the node's feeds
51235183
name: has_feed_subscriber
@@ -7444,6 +7504,25 @@ structures:
74447504
name: sheriff_name
74457505
type: str
74467506
name: SheriffMark
7507+
- fields:
7508+
- name: node_name
7509+
type: str
7510+
- description: node owner's full name
7511+
name: full_name
7512+
optional: true
7513+
type: str
7514+
- description: node title
7515+
name: title
7516+
optional: true
7517+
type: str
7518+
- description: node owner's avatar
7519+
name: avatar
7520+
optional: true
7521+
struct: AvatarImage
7522+
- description: social distance between the node and the client
7523+
name: distance
7524+
type: float
7525+
name: SearchNodeInfo
74477526
- fields:
74487527
- description: name of the setting
74497528
name: name
@@ -8577,10 +8656,7 @@ structures:
85778656
name: remote_posting_id
85788657
optional: true
85798658
type: str
8580-
- constraints:
8581-
- notnull:
8582-
error: subscription.reason.missing
8583-
description: subscription reason
8659+
- description: subscription reason
85848660
enum: SubscriptionReason
85858661
name: reason
85868662
optional: true

0 commit comments

Comments
 (0)