Forum Discussion

Lito's avatar
Lito
Explorer | Level 4
5 years ago

Re: search_v2 API does not work when using id

Anyway, I can not disable the "filename_and_content" option. I only want to search into filename, not content.

 

The request to search_v2:

{
    "query": "screen",
    "options": {
        "path": "id:XXXX",
        "max_results": 1000,
        "file_status": "active",
        "filename_only": true,
        "order_by": "last_modified_time"
    },
    "match_field_options": {
        "include_highlights": false
    }
}

Response:

{
    "has_more": false,
    "matches": [
        {
            "match_type": {
                ".tag": "filename_and_content"
            },
            "metadata": {
                ".tag": "metadata",
                "metadata": {
                    ".tag": "file",
                    ...
                }
            }
        },
        {
            "match_type": {
                ".tag": "filename_and_content"
            },
            "metadata": {
                ".tag": "metadata",
                "metadata": {
                    ".tag": "file",
                    ...
                }
            }
        },
        {
            "match_type": {
                ".tag": "filename_and_content"
            },
            "metadata": {
                ".tag": "metadata",
                "metadata": {
                    ".tag": "file",
                    ...
                }
            }
        }
    ]
}

Only one of the tree files has the "screen" word into name.

 

Thanks!

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Lito Thanks for the report! Would you be able to share an unredacted request and response (please do redact the access token itself of course) showing this issue so we can better investigate? Please do so by opening an API ticket if so. Thanks in advance.

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks! We'll look into it and follow up with you soon.