Skip to content

Commit

Permalink
Swap order of bucket database_file for s3-ocr index, closes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 30, 2022
1 parent 62e8cd0 commit 775c7c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ This design for the tool, with the `.s3-ocr.json` files tracking jobs that have

## Creating a SQLite index of your OCR results

The `s3-ocr index <database_file> <bucket>` command creates a SQLite database contaning the results of the OCR, and configure SQLite full-text search for the text:
The `s3-ocr index <bucket> <database_file>` command creates a SQLite database contaning the results of the OCR, and configure SQLite full-text search for the text:

```
% s3-ocr index index.db sfms-history
% s3-ocr index sfms-history index.db
Fetching job details [####################################] 100%
Populating pages table [####################----------------] 55% 00:03:18
```
Expand Down Expand Up @@ -262,7 +262,7 @@ cog.out(
)
]]] -->
```
Usage: s3-ocr index [OPTIONS] DATABASE BUCKET
Usage: s3-ocr index [OPTIONS] BUCKET DATABASE
Create a SQLite database with OCR results for files in a bucket
Expand Down
4 changes: 2 additions & 2 deletions s3_ocr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ def text(bucket, key, divider, **boto_options):


@cli.command
@click.argument("bucket")
@click.argument(
"database",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
required=True,
)
@click.argument("bucket")
@common_boto3_options
def index(database, bucket, **boto_options):
def index(bucket, database, **boto_options):
"Create a SQLite database with OCR results for files in a bucket"
db = sqlite_utils.Database(database)
if not db["pages"].exists():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_s3_ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_index(s3, tmpdir):
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(
cli, ["index", index_db, "my-bucket"], catch_exceptions=False
cli, ["index", "my-bucket", index_db], catch_exceptions=False
)
assert result.exit_code == 0
db = sqlite_utils.Database(index_db)
Expand Down

0 comments on commit 775c7c3

Please sign in to comment.