Skip to content

Commit

Permalink
Add exclude param (#38)
Browse files Browse the repository at this point in the history
* quick fix, use exclude

* quick fix, use exclude
  • Loading branch information
davidschober authored Oct 12, 2024
1 parent c0c1976 commit b133bb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions nuldc/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def dump_collection(col_id):
params = {
"query": f"collection.id:{col_id}",
"size": "25",
"sort": "id:asc"}
"sort": "id:asc",
"_source_excludes":"embedding"}
try:
data = helpers.get_search_results(API,
"works",
Expand All @@ -76,7 +77,7 @@ def dump_collection(col_id):
filename = f"{slugify(col_title)}-{col_id}"
save_files(filename, data)
except Exception as e:
sys.exit(f"Error with collection {col_id}: {e} \n\n CONTEXT: {data}")
sys.exit(f"Error with collection {col_id}: {e} \n\n CONTEXT:")


def dump_collections(query_string):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_nuldc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _mock_dcapi(next_url):
"parent": {"child": "child value1",
"label": "parent1 label"},
"list": ["1", "2", "3"],
"embedding": [.9, .8, .7, .6]},
"embedding": [.9, .8, .7, .6]},
{"id": "2",
"title": "2 title",
"parent": {"child": "child value2",
Expand Down Expand Up @@ -70,12 +70,12 @@ def _mock_dcapi_iiif():
"id": "https://example.org/iiif/result-2.json",
"type": "Manifest",
"label": {"none": ["Paged Collection - Result 2"]}
},
},
{
"id": "https://example.org/iiif/paged-2.json",
"type": "Collection",
"label": {"none": ["Paged Collection - Page 2"]}
}
}
]
}
return data
Expand Down Expand Up @@ -167,6 +167,6 @@ def test_sort_fields_and_values(mock_dcapi):
"parent" in all_fields,
"parent" not in some_fields,
# verify sort
['id','list', 'parent', 'title'] == all_fields,
['id', 'list', 'parent', 'title'] == all_fields,
['1', '1|2|3', 'parent1 label', '1 title'] == all_values[0]]
)

0 comments on commit b133bb0

Please sign in to comment.