Skip to content

Using OR is not working on app.bsky.feed.searchPosts API #3751

Description

@jamestangeres

Using OR on the search query not working. It returns no result

To Reproduce

Steps to reproduce the behavior:

BASE_URL = "https://api.bsky.app"
ENDPOINT = "/xrpc/app.bsky.feed.searchPosts"

search_query = "Bittensor OR TAO OR bittensor OR Aerarium Fi OR AERA OR aerarium-fi OR Render Token OR RNDR OR render-token OR Fetch OR FET OR fetch OR Filecoin [Futures] OR FIL OR filecoin OR ARBITRAGE OR ARB OR arbitrage OR LADZ OR LADZ OR ladz OR Stox OR STX OR stox OR Kaspa OR KAS OR kaspa"

params = {
"q": search_query, # Use the Lucene-compatible query
"limit": 25,
"sort": "latest",
}
print(f"Request parameters: {params}")

try:
# Make the GET request
response = requests.get(
f"{BASE_URL}{ENDPOINT}",
params=params,
timeout=60
)

# Check if the request was successful
if response.status_code == 200:
    data = response.json()
    print("Search Results:")
    for post in data.get("posts", []):
        print(post['cid'])
        print(post['author']['displayName'])
        print(post['record']['text'])
else:
    print(f"Failed to fetch posts for query '{search_query}'. Status code: {response.status_code}, Message: {response.text}")

except requests.exceptions.RequestException as e:
print(f"An error occurred for query '{search_query}': {e}")

Pause between requests to avoid rate-limiting

time.sleep(3)

That's my query above, it returns nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions