Skip to content

Commit 3cee9cc

Browse files
committed
MINOR: add document full text search (#893)
* add document full text search * use cloud language if no language provided * enable text only on ai clouds * fix tests * add comment to doc * fix test with new field
1 parent eecaa77 commit 3cee9cc

14 files changed

+1009
-36
lines changed

.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ bimdata_api_client/model/direction.py
4949
bimdata_api_client/model/direction_request.py
5050
bimdata_api_client/model/document.py
5151
bimdata_api_client/model/document_preview_file.py
52+
bimdata_api_client/model/document_text.py
5253
bimdata_api_client/model/document_with_element_list.py
5354
bimdata_api_client/model/drawing.py
5455
bimdata_api_client/model/drawing_request.py
@@ -121,6 +122,7 @@ bimdata_api_client/model/patched_classification_request.py
121122
bimdata_api_client/model/patched_cloud_request.py
122123
bimdata_api_client/model/patched_comment_request.py
123124
bimdata_api_client/model/patched_document_request.py
125+
bimdata_api_client/model/patched_document_text_request.py
124126
bimdata_api_client/model/patched_drawing_request.py
125127
bimdata_api_client/model/patched_element_request.py
126128
bimdata_api_client/model/patched_folder_without_children_request.py
@@ -320,6 +322,7 @@ docs/Direction.md
320322
docs/DirectionRequest.md
321323
docs/Document.md
322324
docs/DocumentPreviewFile.md
325+
docs/DocumentText.md
323326
docs/DocumentWithElementList.md
324327
docs/Drawing.md
325328
docs/DrawingRequest.md
@@ -393,6 +396,7 @@ docs/PatchedClassificationRequest.md
393396
docs/PatchedCloudRequest.md
394397
docs/PatchedCommentRequest.md
395398
docs/PatchedDocumentRequest.md
399+
docs/PatchedDocumentTextRequest.md
396400
docs/PatchedDrawingRequest.md
397401
docs/PatchedElementRequest.md
398402
docs/PatchedFolderWithoutChildrenRequest.md
@@ -595,6 +599,7 @@ test/test_direction.py
595599
test/test_direction_request.py
596600
test/test_document.py
597601
test/test_document_preview_file.py
602+
test/test_document_text.py
598603
test/test_document_with_element_list.py
599604
test/test_drawing.py
600605
test/test_drawing_request.py
@@ -668,6 +673,7 @@ test/test_patched_classification_request.py
668673
test/test_patched_cloud_request.py
669674
test/test_patched_comment_request.py
670675
test/test_patched_document_request.py
676+
test/test_patched_document_text_request.py
671677
test/test_patched_drawing_request.py
672678
test/test_patched_element_request.py
673679
test/test_patched_folder_without_children_request.py

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ Class | Method | HTTP request | Description
322322
*CollaborationApi* | [**update_cloud**](docs/CollaborationApi.md#update_cloud) | **PATCH** /cloud/{id} | Update some fields of a cloud
323323
*CollaborationApi* | [**update_cloud_user**](docs/CollaborationApi.md#update_cloud_user) | **PATCH** /cloud/{cloud_pk}/user/{id} | Change the user role in the cloud
324324
*CollaborationApi* | [**update_document**](docs/CollaborationApi.md#update_document) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/document/{id} | Update some fields of the document
325+
*CollaborationApi* | [**update_document_text**](docs/CollaborationApi.md#update_document_text) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/document/{id}/text | Update the text representation of a document
325326
*CollaborationApi* | [**update_folder**](docs/CollaborationApi.md#update_folder) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/folder/{id} | Update some fields of a folder
326327
*CollaborationApi* | [**update_group_folder**](docs/CollaborationApi.md#update_group_folder) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/folder/{folder_pk}/group/{id} | Update the permission of a group on a folder. When propagate is set to True, the permission of all children in the folder will be updated.
327328
*CollaborationApi* | [**update_manage_group**](docs/CollaborationApi.md#update_manage_group) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/group/{id} | Update some fields of a group
@@ -555,6 +556,7 @@ Class | Method | HTTP request | Description
555556
- [DirectionRequest](docs/DirectionRequest.md)
556557
- [Document](docs/Document.md)
557558
- [DocumentPreviewFile](docs/DocumentPreviewFile.md)
559+
- [DocumentText](docs/DocumentText.md)
558560
- [DocumentWithElementList](docs/DocumentWithElementList.md)
559561
- [Drawing](docs/Drawing.md)
560562
- [DrawingRequest](docs/DrawingRequest.md)
@@ -627,6 +629,7 @@ Class | Method | HTTP request | Description
627629
- [PatchedCloudRequest](docs/PatchedCloudRequest.md)
628630
- [PatchedCommentRequest](docs/PatchedCommentRequest.md)
629631
- [PatchedDocumentRequest](docs/PatchedDocumentRequest.md)
632+
- [PatchedDocumentTextRequest](docs/PatchedDocumentTextRequest.md)
630633
- [PatchedDrawingRequest](docs/PatchedDrawingRequest.md)
631634
- [PatchedElementRequest](docs/PatchedElementRequest.md)
632635
- [PatchedFolderWithoutChildrenRequest](docs/PatchedFolderWithoutChildrenRequest.md)

bimdata_api_client/api/collaboration_api.py

Lines changed: 183 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from bimdata_api_client.model.cloud_request import CloudRequest
3232
from bimdata_api_client.model.document import Document
3333
from bimdata_api_client.model.document_preview_file import DocumentPreviewFile
34+
from bimdata_api_client.model.document_text import DocumentText
3435
from bimdata_api_client.model.folder import Folder
3536
from bimdata_api_client.model.folder_tree import FolderTree
3637
from bimdata_api_client.model.folder_user_project import FolderUserProject
@@ -44,6 +45,7 @@
4445
from bimdata_api_client.model.patched_classification_request import PatchedClassificationRequest
4546
from bimdata_api_client.model.patched_cloud_request import PatchedCloudRequest
4647
from bimdata_api_client.model.patched_document_request import PatchedDocumentRequest
48+
from bimdata_api_client.model.patched_document_text_request import PatchedDocumentTextRequest
4749
from bimdata_api_client.model.patched_folder_without_children_request import PatchedFolderWithoutChildrenRequest
4850
from bimdata_api_client.model.patched_group_folder_request import PatchedGroupFolderRequest
4951
from bimdata_api_client.model.patched_group_request import PatchedGroupRequest
@@ -3472,9 +3474,11 @@ def __init__(self, api_client=None):
34723474
'name__contains',
34733475
'name__endswith',
34743476
'name__startswith',
3477+
'search',
34753478
'size_max',
34763479
'size_min',
34773480
'tags',
3481+
'text',
34783482
'visa__creator_email',
34793483
'visa__deadline_after',
34803484
'visa__deadline_before',
@@ -3566,12 +3570,16 @@ def __init__(self, api_client=None):
35663570
(str,),
35673571
'name__startswith':
35683572
(str,),
3573+
'search':
3574+
(str,),
35693575
'size_max':
35703576
(int, none_type,),
35713577
'size_min':
35723578
(int, none_type,),
35733579
'tags':
35743580
([str],),
3581+
'text':
3582+
(bool,),
35753583
'visa__creator_email':
35763584
(str,),
35773585
'visa__deadline_after':
@@ -3610,9 +3618,11 @@ def __init__(self, api_client=None):
36103618
'name__contains': 'name__contains',
36113619
'name__endswith': 'name__endswith',
36123620
'name__startswith': 'name__startswith',
3621+
'search': 'search',
36133622
'size_max': 'size_max',
36143623
'size_min': 'size_min',
36153624
'tags': 'tags',
3625+
'text': 'text',
36163626
'visa__creator_email': 'visa__creator_email',
36173627
'visa__deadline_after': 'visa__deadline_after',
36183628
'visa__deadline_before': 'visa__deadline_before',
@@ -3642,9 +3652,11 @@ def __init__(self, api_client=None):
36423652
'name__contains': 'query',
36433653
'name__endswith': 'query',
36443654
'name__startswith': 'query',
3655+
'search': 'query',
36453656
'size_max': 'query',
36463657
'size_min': 'query',
36473658
'tags': 'query',
3659+
'text': 'query',
36483660
'visa__creator_email': 'query',
36493661
'visa__deadline_after': 'query',
36503662
'visa__deadline_before': 'query',
@@ -3768,6 +3780,7 @@ def __init__(self, api_client=None):
37683780
'name__contains',
37693781
'name__endswith',
37703782
'name__startswith',
3783+
'search',
37713784
'size_max',
37723785
'size_min',
37733786
'tags',
@@ -3865,6 +3878,8 @@ def __init__(self, api_client=None):
38653878
(str,),
38663879
'name__startswith':
38673880
(str,),
3881+
'search':
3882+
(str,),
38683883
'size_max':
38693884
(int, none_type,),
38703885
'size_min':
@@ -3910,6 +3925,7 @@ def __init__(self, api_client=None):
39103925
'name__contains': 'name__contains',
39113926
'name__endswith': 'name__endswith',
39123927
'name__startswith': 'name__startswith',
3928+
'search': 'search',
39133929
'size_max': 'size_max',
39143930
'size_min': 'size_min',
39153931
'tags': 'tags',
@@ -3943,6 +3959,7 @@ def __init__(self, api_client=None):
39433959
'name__contains': 'query',
39443960
'name__endswith': 'query',
39453961
'name__startswith': 'query',
3962+
'search': 'query',
39463963
'size_max': 'query',
39473964
'size_min': 'query',
39483965
'tags': 'query',
@@ -6935,6 +6952,80 @@ def __init__(self, api_client=None):
69356952
},
69366953
api_client=api_client
69376954
)
6955+
self.update_document_text_endpoint = _Endpoint(
6956+
settings={
6957+
'response_type': (DocumentText,),
6958+
'auth': [
6959+
'ApiKey',
6960+
'BIMData_Connect',
6961+
'BIMData_Connect',
6962+
'Bearer'
6963+
],
6964+
'endpoint_path': '/cloud/{cloud_pk}/project/{project_pk}/document/{id}/text',
6965+
'operation_id': 'update_document_text',
6966+
'http_method': 'PATCH',
6967+
'servers': None,
6968+
},
6969+
params_map={
6970+
'all': [
6971+
'cloud_pk',
6972+
'id',
6973+
'project_pk',
6974+
'patched_document_text_request',
6975+
],
6976+
'required': [
6977+
'cloud_pk',
6978+
'id',
6979+
'project_pk',
6980+
],
6981+
'nullable': [
6982+
],
6983+
'enum': [
6984+
],
6985+
'validation': [
6986+
]
6987+
},
6988+
root_map={
6989+
'validations': {
6990+
},
6991+
'allowed_values': {
6992+
},
6993+
'openapi_types': {
6994+
'cloud_pk':
6995+
(int,),
6996+
'id':
6997+
(int,),
6998+
'project_pk':
6999+
(int,),
7000+
'patched_document_text_request':
7001+
(PatchedDocumentTextRequest,),
7002+
},
7003+
'attribute_map': {
7004+
'cloud_pk': 'cloud_pk',
7005+
'id': 'id',
7006+
'project_pk': 'project_pk',
7007+
},
7008+
'location_map': {
7009+
'cloud_pk': 'path',
7010+
'id': 'path',
7011+
'project_pk': 'path',
7012+
'patched_document_text_request': 'body',
7013+
},
7014+
'collection_format_map': {
7015+
}
7016+
},
7017+
headers_map={
7018+
'accept': [
7019+
'application/json'
7020+
],
7021+
'content_type': [
7022+
'application/json',
7023+
'application/x-www-form-urlencoded',
7024+
'multipart/form-data'
7025+
]
7026+
},
7027+
api_client=api_client
7028+
)
69387029
self.update_folder_endpoint = _Endpoint(
69397030
settings={
69407031
'response_type': (FolderWithoutChildren,),
@@ -8815,7 +8906,7 @@ def create_document(
88158906
):
88168907
"""Create a document # noqa: E501
88178908

8818-
Create a document. If the document is one of {'GLTF', 'IFC', 'OBJ', 'POINT_CLOUD', 'DXF', 'DWG'}, a model will be created and attached to this document Required scopes: document:write # noqa: E501
8909+
Create a document. If the document is one of {'IFC', 'POINT_CLOUD', 'DWG', 'DXF', 'GLTF', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write # noqa: E501
88198910
This method makes a synchronous HTTP request by default. To make an
88208911
asynchronous HTTP request, please pass async_req=True
88218912

@@ -11980,7 +12071,7 @@ def get_documents(
1198012071
):
1198112072
"""Retrieve all documents # noqa: E501
1198212073

11983-
Retrieve all documents in the project. Filters are case insentive Required scopes: document:read # noqa: E501
12074+
Retrieve all documents in the project. Filters are case insentive. Search filter only works if AI features are enabled. Required scopes: document:read # noqa: E501
1198412075
This method makes a synchronous HTTP request by default. To make an
1198512076
asynchronous HTTP request, please pass async_req=True
1198612077

@@ -12008,9 +12099,11 @@ def get_documents(
1200812099
name__contains (str): [optional]
1200912100
name__endswith (str): [optional]
1201012101
name__startswith (str): [optional]
12102+
search (str): [optional]
1201112103
size_max (int, none_type): Size of the file.. [optional]
1201212104
size_min (int, none_type): Size of the file.. [optional]
1201312105
tags ([str]): Multiple values may be separated by commas.. [optional]
12106+
text (bool): If this field is present (with any value), the full text representation of the documents will be added to the response under the field `text`. [optional]
1201412107
visa__creator_email (str): [optional]
1201512108
visa__deadline_after (date): [optional]
1201612109
visa__deadline_before (date): [optional]
@@ -12206,6 +12299,7 @@ def get_folder_documents(
1220612299
name__contains (str): [optional]
1220712300
name__endswith (str): [optional]
1220812301
name__startswith (str): [optional]
12302+
search (str): [optional]
1220912303
size_max (int, none_type): Size of the file.. [optional]
1221012304
size_min (int, none_type): Size of the file.. [optional]
1221112305
tags ([str]): Multiple values may be separated by commas.. [optional]
@@ -16087,6 +16181,93 @@ def update_document(
1608716181
project_pk
1608816182
return self.update_document_endpoint.call_with_http_info(**kwargs)
1608916183

16184+
def update_document_text(
16185+
self,
16186+
cloud_pk,
16187+
id,
16188+
project_pk,
16189+
**kwargs
16190+
):
16191+
"""Update the text representation of a document # noqa: E501
16192+
16193+
Update the text representation of a document. The document itself will not be changed. It is useful for full text search Required scopes: document:write # noqa: E501
16194+
This method makes a synchronous HTTP request by default. To make an
16195+
asynchronous HTTP request, please pass async_req=True
16196+
16197+
>>> thread = api.update_document_text(cloud_pk, id, project_pk, async_req=True)
16198+
>>> result = thread.get()
16199+
16200+
Args:
16201+
cloud_pk (int): A unique integer value identifying this cloud.
16202+
id (int): A unique integer value identifying this document.
16203+
project_pk (int): A unique integer value identifying this project.
16204+
16205+
Keyword Args:
16206+
patched_document_text_request (PatchedDocumentTextRequest): [optional]
16207+
_return_http_data_only (bool): response data without head status
16208+
code and headers. Default is True.
16209+
_preload_content (bool): if False, the urllib3.HTTPResponse object
16210+
will be returned without reading/decoding response data.
16211+
Default is True.
16212+
_request_timeout (int/float/tuple): timeout setting for this request. If
16213+
one number provided, it will be total request timeout. It can also
16214+
be a pair (tuple) of (connection, read) timeouts.
16215+
Default is None.
16216+
_check_input_type (bool): specifies if type checking
16217+
should be done one the data sent to the server.
16218+
Default is True.
16219+
_check_return_type (bool): specifies if type checking
16220+
should be done one the data received from the server.
16221+
Default is True.
16222+
_spec_property_naming (bool): True if the variable names in the input data
16223+
are serialized names, as specified in the OpenAPI document.
16224+
False if the variable names in the input data
16225+
are pythonic names, e.g. snake case (default)
16226+
_content_type (str/None): force body content-type.
16227+
Default is None and content-type will be predicted by allowed
16228+
content-types and body.
16229+
_host_index (int/None): specifies the index of the server
16230+
that we want to use.
16231+
Default is read from the configuration.
16232+
async_req (bool): execute request asynchronously
16233+
16234+
Returns:
16235+
DocumentText
16236+
If the method is called asynchronously, returns the request
16237+
thread.
16238+
"""
16239+
kwargs['async_req'] = kwargs.get(
16240+
'async_req', False
16241+
)
16242+
kwargs['_return_http_data_only'] = kwargs.get(
16243+
'_return_http_data_only', True
16244+
)
16245+
kwargs['_preload_content'] = kwargs.get(
16246+
'_preload_content', True
16247+
)
16248+
kwargs['_request_timeout'] = kwargs.get(
16249+
'_request_timeout', None
16250+
)
16251+
kwargs['_check_input_type'] = kwargs.get(
16252+
'_check_input_type', True
16253+
)
16254+
kwargs['_check_return_type'] = kwargs.get(
16255+
'_check_return_type', True
16256+
)
16257+
kwargs['_spec_property_naming'] = kwargs.get(
16258+
'_spec_property_naming', False
16259+
)
16260+
kwargs['_content_type'] = kwargs.get(
16261+
'_content_type')
16262+
kwargs['_host_index'] = kwargs.get('_host_index')
16263+
kwargs['cloud_pk'] = \
16264+
cloud_pk
16265+
kwargs['id'] = \
16266+
id
16267+
kwargs['project_pk'] = \
16268+
project_pk
16269+
return self.update_document_text_endpoint.call_with_http_info(**kwargs)
16270+
1609016271
def update_folder(
1609116272
self,
1609216273
cloud_pk,

0 commit comments

Comments
 (0)