Skill Tracer
Skills › Scientific Agent Skills › pyzotero › full-text.md

full-text.md

72 lines · skills/pyzotero/references/full-text.md at 5f2bc03

Open on GitHub
1# Full-Text Content
2
3Pyzotero can retrieve and set full-text index content for attachment items.
4

Full-Text Content

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

Raw lines 1 to 4
5## Retrieving Full-Text Content
6
7```python
8# Get full-text content for a specific attachment item
9data = zot.fulltext_item('ATTACHMENTKEY')
10# Returns:
11# {
12# "content": "Full text of the document...",
13# "indexedPages": 50,
14# "totalPages": 50
15# }
16# For text docs: indexedChars/totalChars instead of pages
18text = data['content']
19unit = 'Pages' if 'totalPages' in data else 'Chars'
20total = data.get('total' + unit, 0)
21coverage = data.get('indexed' + unit, 0) / total if total else None
22```

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
Raw lines 5 to 23
24## Finding Items with New Full-Text Content
26```python
27# Get item keys with full-text updated since a library version
28new_fulltext = zot.new_fulltext(since=1085)
29# Returns dict: {'KEY1': 1090, 'KEY2': 1095, ...}
30# Values are the library version at which full-text was indexed
31```

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
Raw lines 24 to 32
33## Setting Full-Text Content
35```python
36# Set full-text for a PDF attachment
37payload = {
38 'content': 'The full text content of the document.',
39 'indexedPages': 50,
40 'totalPages': 50
42zot.set_fulltext('ATTACHMENTKEY', payload)
44# For text documents use indexedChars/totalChars
45payload = {
46 'content': 'Full text here.',
47 'indexedChars': len('Full text here.'),
48 'totalChars': len('Full text here.')
50zot.set_fulltext('ATTACHMENTKEY', payload)
51```

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)
Raw lines 33 to 52
53## Full-Text Search via CLI
55The CLI provides full-text search across locally indexed PDFs:
57```bash
58# Search full-text content
59pyzotero search -q "CRISPR gene editing" --fulltext
61# Output as JSON (retrieves parent bibliographic items for attachments)
62pyzotero search -q "climate tipping points" --fulltext --json
63```

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
Raw lines 53 to 64
65## Search in API (qmode=everything)
67```python
68# Search in titles/creators + full-text content
69results = zot.items(q='protein folding', qmode='everything', limit=20)
70```
72`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](https://www.zotero.org/support/dev/web_api/v3/fulltext_content).

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.

Raw lines 65 to 72