INNER CODE UNIT · Python

exists

browser-use/bux · agent/agency_db.py:257

def exists(db: sqlite3.Connection, source: str) -> dict[str, Any] | None:
    cur = db.execute(
        "SELECT * FROM suggestions WHERE source = ? ORDER BY id DESC LIMIT 1",
        (source,),
    )
    row = cur.fetchone()
    return dict(row) if row else None


def search(
    db: sqlite3.Connection, query: str, limit: int = 10
) -> list[dict[str, Any]]:
    """Fuzzy LIKE-search across title + description. Lower-cases both."""
    q = f"%{query.lower()}%"
    cur = db.execute(
        """
        SELECT * FROM suggestions
         WHERE LOWER(title) LIKE ? OR LOWER(description) LIKE ?

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…