Skip to content

Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.

2.4 KB
Raw Blame

Full-Text Content

Pyzotero can retrieve and set full-text index content for attachment items.

Retrieving Full-Text Content

# Get full-text content for a specific attachment item
data = zot.fulltext_item('ATTACHMENTKEY')
# Returns:
# {
#   "content": "Full text of the document...",
#   "indexedPages": 50,
#   "totalPages": 50
# }
# For text docs: indexedChars/totalChars instead of pages

text = data['content']
unit = 'Pages' if 'totalPages' in data else 'Chars'
total = data.get('total' + unit, 0)
coverage = data.get('indexed' + unit, 0) / total if total else None

Finding Items with New Full-Text Content

# Get item keys with full-text updated since a library version
new_fulltext = zot.new_fulltext(since=1085)
# Returns dict: {'KEY1': 1090, 'KEY2': 1095, ...}
# Values are the library version at which full-text was indexed

Setting Full-Text Content

# Set full-text for a PDF attachment
payload = {
    'content': 'The full text content of the document.',
    'indexedPages': 50,
    'totalPages': 50
}
zot.set_fulltext('ATTACHMENTKEY', payload)

# For text documents use indexedChars/totalChars
payload = {
    'content': 'Full text here.',
    'indexedChars': len('Full text here.'),
    'totalChars': len('Full text here.')
}
zot.set_fulltext('ATTACHMENTKEY', payload)

Full-Text Search via CLI

The CLI provides full-text search across locally indexed PDFs:

# Search full-text content
pyzotero search -q "CRISPR gene editing" --fulltext

# Output as JSON (retrieves parent bibliographic items for attachments)
pyzotero search -q "climate tipping points" --fulltext --json

Search in API (qmode=everything)

# Search in titles/creators + full-text content
results = zot.items(q='protein folding', qmode='everything', limit=20)

fulltext_item() sends GET to /items/{attachmentKey}/fulltext; a 404 can mean missing indexed content as well as a missing item. new_fulltext() uses /fulltext?since=<version> and returns a key-to-version dict. set_fulltext() PUTs the supplied index and returns Boolean success; it does not extract text from a PDF. Supply the actual extracted content and coverage, not guessed counts. Remote search sees synced indexed content; local search sees the local index and can differ. Keep local server versions separate from Web API versions. Official full-text contract.