Skip to content

Commit 8800c3c

Browse files
committed
fix:PRComments
1 parent d1edee9 commit 8800c3c

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

examples/file/search_files.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
# Configure connection to SystemLink server
1111
server_configuration = HttpConfiguration(
12-
server_uri="https://test-api.lifecyclesolutions.ni.com/",
13-
api_key="9voCglXGPBxU6-ZIQyFEwmIAymkdn_ynqOO7t52q2v",
12+
server_uri="https://yourserver.yourcompany.com",
13+
api_key="YourAPIKeyGeneratedFromSystemLink",
1414
)
1515

1616
client = FileClient(configuration=server_configuration)
@@ -26,7 +26,6 @@
2626

2727
# Wait for the file to be indexed for search
2828
# Note: Files may take a few seconds to appear in search results after upload
29-
print("Waiting 5 seconds for file to be indexed for search...")
3029
time.sleep(5)
3130
print()
3231

@@ -89,25 +88,19 @@
8988

9089
# Example 4: Search by multiple custom properties
9190
print("\nExample 4: Search by multiple custom properties")
92-
# First upload a file with custom properties for demonstration
93-
print("Uploading file with custom properties...")
94-
test_file_2 = io.BytesIO(b"Custom properties test file")
95-
test_file_2.name = "custom-props-test.txt"
96-
file_id_2 = client.upload_file(file=test_file_2)
97-
98-
# Update the file with custom properties
91+
print("Adding custom properties to existing file...")
9992

93+
# Update the existing file with custom properties
10094
custom_metadata = UpdateMetadataRequest(
10195
replace_existing=False,
10296
properties={
10397
"TestProperty1": "TestValue1",
10498
"TestProperty2": "TestValue2",
10599
},
106100
)
107-
client.update_metadata(metadata=custom_metadata, id=file_id_2)
101+
client.update_metadata(metadata=custom_metadata, id=file_id)
108102

109103
# Wait for indexing
110-
print("Waiting 5 seconds for custom properties to be indexed...")
111104
time.sleep(5)
112105

113106
# Search by multiple custom properties using AND operator
@@ -129,8 +122,7 @@
129122
print(f" TestProperty1: {file.properties.get('TestProperty1')}")
130123
print(f" TestProperty2: {file.properties.get('TestProperty2')}")
131124

132-
# Clean up: delete both test files
125+
# Clean up: delete the test file
133126
print("\nCleaning up...")
134127
client.delete_file(id=file_id)
135-
client.delete_file(id=file_id_2)
136-
print(f"Deleted test files with IDs: {file_id}, {file_id_2}")
128+
print(f"Deleted test file with ID: {file_id}")

nisystemlink/clients/file/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ._file_metadata import FileMetadata, LinqQueryFileMetadata
1+
from ._file_metadata import FileMetadata
22
from ._file_query_order_by import FileQueryOrderBy, FileLinqQueryOrderBy
33
from ._file_query_response import FileQueryResponse
44
from ._link import Link

nisystemlink/clients/file/models/_file_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class FileMetadata(BaseFileMetadata):
8686

8787

8888
class LinqQueryFileMetadata(BaseFileMetadata):
89-
"""Metadata for a file returned by a query or search operation."""
89+
"""Metadata for a file returned by a LINQ query."""
9090

9191
updated: datetime | None = None
9292
"""

0 commit comments

Comments
 (0)