@@ -82,7 +82,6 @@ def __init__(self, client, index_name):
8282 self .index_name = index_name
8383 self ._request_path = '/1/indexes/%s' % safe (self .index_name )
8484
85-
8685 @deprecated
8786 def addObject (self , content , object_id = None ):
8887 return self .add_object (content , object_id )
@@ -141,19 +140,20 @@ def get_object(self, object_id, attributes_to_retrieve=None):
141140 def getObjects (self , object_ids ):
142141 return self .get_objects (object_ids )
143142
144- def get_objects (self , object_ids ):
143+ def get_objects (self , object_ids , attributes_to_retrieve = None ):
145144 """
146145 Get several objects from this index.
147146
148147 @param object_ids the array of unique identifier of objects to retrieve
148+ @param attributes_to_retrieve (optional) if set, contains the list
149+ of attributes to retrieve as a string separated by a comma
149150 """
150-
151151 requests = []
152152 for object_id in object_ids :
153- requests . append ({
154- 'indexName' : self . index_name ,
155- 'objectID' : object_id
156- } )
153+ request = { 'indexName' : self . index_name , 'objectID' : object_id }
154+ if attributes_to_retrieve is not None :
155+ request [ 'attributesToRetrieve' ] = "," . join ( attributes_to_retrieve )
156+ requests . append ( request )
157157 data = {'requests' : requests }
158158 path = '/1/indexes/*/objects' # Use client._req()
159159 return self .client ._req (True , path , 'POST' , data = data )
@@ -487,7 +487,7 @@ def search_disjunctive_faceting(self, query, disjunctive_facets,
487487 for i in range (1 , len (answers ['results' ])):
488488 for facet in answers ['results' ][i ]['facets' ]:
489489 aggregated_answer ['disjunctiveFacets' ][facet ] = (
490- answers ['results' ][i ]['facets' ][facet ])
490+ answers ['results' ][i ]['facets' ][facet ])
491491
492492 if facet not in disjunctive_refinements :
493493 continue
0 commit comments