Skip to content

Commit

Permalink
Improves search by npubs to use all relays.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Dec 5, 2024
1 parent 3aa1588 commit bcb9ba2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
package com.vitorpamplona.amethyst.service

import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
import com.vitorpamplona.ammolite.relays.ALL_FEED_TYPES
import com.vitorpamplona.ammolite.relays.FeedType
import com.vitorpamplona.ammolite.relays.TypedFilter
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
Expand Down Expand Up @@ -96,7 +96,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
listOfNotNull(
ATag.parse(it, null)?.let { aTag ->
TypedFilter(
types = COMMON_FEED_TYPES,
types = ALL_FEED_TYPES,
filter =
SincePerRelayFilter(
kinds = listOf(MetadataEvent.KIND, aTag.kind),
Expand All @@ -111,19 +111,19 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
// event ids
listOf(
TypedFilter(
types = COMMON_FEED_TYPES,
types = ALL_FEED_TYPES,
filter =
SincePerRelayFilter(
ids = listOfNotNull(hexToWatch),
ids = listOfNotNull(it),
),
),
// authors
TypedFilter(
types = COMMON_FEED_TYPES,
types = ALL_FEED_TYPES,
filter =
SincePerRelayFilter(
kinds = listOf(MetadataEvent.KIND),
authors = listOfNotNull(hexToWatch),
authors = listOfNotNull(it),
// just to be sure
limit = 5,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ enum class FeedType {
WALLET_CONNECT,
}

val ALL_FEED_TYPES =
setOf(FeedType.FOLLOWS, FeedType.PUBLIC_CHATS, FeedType.PRIVATE_DMS, FeedType.GLOBAL, FeedType.SEARCH)

val COMMON_FEED_TYPES =
setOf(FeedType.FOLLOWS, FeedType.PUBLIC_CHATS, FeedType.PRIVATE_DMS, FeedType.GLOBAL)

Expand Down

0 comments on commit bcb9ba2

Please sign in to comment.