N4S4 / synology-api

A Python wrapper around Synology API
MIT License
360 stars 137 forks source link

About Universal search Api parameter #114

Closed kewell2000 closed 1 year ago

kewell2000 commented 1 year ago

Hi, there. I use this api for a while. And i want to know is there any explanation of Universal search api parameter? Like search field, search type(folder or file). I really confused about the function below without a guide.

def search(self, keyword): api_name = 'SYNO.Finder.FileIndexing.Search' info=self.finder_list[api_name] api_path = info['path']

req_param={ "query_serial":1, "indice":'[]', "keyword":keyword, "orig_keyword":keyword, "criteria_list":'[]', "from":0, "size":10, "fields":'["SYNOMDAcquisitionMake","SYNOMDAcquisitionModel","SYNOMDAlbum","SYNOMDAperture","SYNOMDAudioBitRate","SYNOMDAudioTrackNumber","SYNOMDAuthors","SYNOMDCodecs","SYNOMDContentCreationDate","SYNOMDContentModificationDate","SYNOMDCreator","SYNOMDDurationSecond","SYNOMDExposureTimeString","SYNOMDExtension","SYNOMDFSCreationDate","SYNOMDFSName","SYNOMDFSSize","SYNOMDISOSpeed","SYNOMDLastUsedDate","SYNOMDMediaTypes","SYNOMDMusicalGenre","SYNOMDOwnerUserID","SYNOMDOwnerUserName","SYNOMDRecordingYear","SYNOMDResolutionHeightDPI","SYNOMDResolutionWidthDPI","SYNOMDTitle","SYNOMDVideoBitRate","SYNOMDIsEncrypted"]', "file_type":"", "search_weight_list":'[{"field":"SYNOMDWildcard","weight":1},{"field":"SYNOMDTextContent","weight":1},{"field":"SYNOMDSearchFileName","weight":8.5,"trailing_wildcard":"true"}]', "sorter_field":"relevance", "sorter_direction":"asc", "sorter_use_nature_sort":"false", "sorter_show_directory_first":"true", "api":"SYNO.Finder.FileIndexing.Search", "method":"search", "version":1 }

N4S4 commented 1 year ago

Hi,

well not much to say, keyword param is a string you need to input, it will return search results in json format... what is your exact concern or confusion?

kewell2000 commented 1 year ago

It's my fault. I did't say clearly. I mean if there any possible to search in a specific folder? Or, search only folder, exclude files?