Answers.Body: <p>I figured it out.  I was using folderID instead of volumeID.  It looks like this parameter changed from Craft 2 to Craft 3.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-07T18:06:22.857Z
Answers.LastActivityDate: 2018-12-07T18:06:22.857Z
Answers.UserDisplayName: Lori
Body: <p>I'm successfully using the .search element attribute to search asset filenames stored locally.</p>
  
  <pre><code>{% set mediaExists = craft.assets.folderId('6').search('filename:' ~ vLogID|slice(0, 5)) %}
  </code></pre>
  
  <p>Is it possible to search filenames stored on a remote Amazon S3 volume?</p>
  
  <p>In my testing, it doesn't seem to be finding the remote files. It works when searching the local volume folderId('3') by not when the remote S3 folder folderId('6').</p>
  
  <hr>
  
  <p><strong>Background:</strong>
  There is no direct relationship between an entry and assets. I upload all assets to the server via FTP and then index the volume in my Craft Control Panel. I can see the S3 asset in Craft CP and have cleared cache and reindexed the S3 folder source.</p>
  
  <p>I am using a url query string to tell the template what the LogID is for the entry that is displayed. Then, the code searches the asset folder for any assets that contain that LogID number. If there are any matches, then those assets are displayed on the front end page in a slider.</p>
  
  <p>I can see the S3 asset if I type in the direct asset url link so the permissions of Public seem to be set correctly.</p>
  
  <hr>
  
  <p><strong>This is my code that is searching the asset filename on the server:</strong></p>
  
  <pre><code>&lt;!-- grab log id and use slice filter  --&gt;
  {% set vLogID = craft.app.request.segments|last %}
  
  &lt;!-- Check to see if there is any media uploaded  --&gt;
  {% set mediaExists = craft.assets.folderId('6').search('filename:' ~ vLogID|slice(0, 5)) %}
  </code></pre>
  
  <p><strong>The above code says:</strong></p>
  
  <p>Grab the LogID from the url query string (example: 12345).</p>
  
  <p>Then, search the asset folder (set by folderID), search all of the files in the folder for any filenames that contain LogID (example 12345).</p>
  
  <p>It works when searching the local volume folderId('3') but not when the remote S3 folder folderId('6').</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-06T23:40:38.907Z
Comments.Text: It should work the same. Regardless of if the volume is local or remote, when you use `.search()`, it's actually searching against the `searchindex` table in the database. If you search that table, do you see the filename as a search keyword for what you're searching for? Also, what is the filename?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-06T23:47:00.887Z
Comments.Text: @BradBell One file name is: "20180919-15472-993-vid-01.mp4"  Yes, when I search the searchIndex table "keywords contains" and type in the LogID "15472" I see them all.  Here's a screenshot: https://d.pr/i/gJfAS9 and here's a screenshot of the "craft_assets" table showing the files in both the local and S3 source folders: https://d.pr/i/baJRO4
Comments.UserDisplayName: Lori
Tags: <assets><search><s3>
Title: Is it possible to search an asset filename stored on a remote Amazon S3 volume?
ThreadText: # Is it possible to search an asset filename stored on a remote Amazon S3 volume?
  
  (Asked by: username_0 on 2018-12-06)
  
  I'm successfully using the .search element attribute to search asset filenames stored locally.
  
  ```
  {% set mediaExists = craft.assets.folderId('6').search('filename:' ~ vLogID|slice(0, 5)) %}
  
  ```
  
  Is it possible to search filenames stored on a remote Amazon S3 volume?
  
  In my testing, it doesn't seem to be finding the remote files. It works when searching the local volume folderId('3') by not when the remote S3 folder folderId('6').
  
  ---
  
  **Background:**
  There is no direct relationship between an entry and assets. I upload all assets to the server via FTP and then index the volume in my Craft Control Panel. I can see the S3 asset in Craft CP and have cleared cache and reindexed the S3 folder source.
  
  I am using a url query string to tell the template what the LogID is for the entry that is displayed. Then, the code searches the asset folder for any assets that contain that LogID number. If there are any matches, then those assets are displayed on the front end page in a slider.
  
  I can see the S3 asset if I type in the direct asset url link so the permissions of Public seem to be set correctly.
  
  ---
  
  **This is my code that is searching the asset filename on the server:**
  
  ```
  <!-- grab log id and use slice filter  -->
  {% set vLogID = craft.app.request.segments|last %}
  
  <!-- Check to see if there is any media uploaded  -->
  {% set mediaExists = craft.assets.folderId('6').search('filename:' ~ vLogID|slice(0, 5)) %}
  
  ```
  
  **The above code says:**
  
  Grab the LogID from the url query string (example: 12345).
  
  Then, search the asset folder (set by folderID), search all of the files in the folder for any filenames that contain LogID (example 12345).
  
  It works when searching the local volume folderId('3') but not when the remote S3 folder folderId('6').
  
  **Tags:** assets, search, s3
  
  > **Comments:**
  > **username_1**: It should work the same. Regardless of if the volume is local or remote, when you use `.search()`, it's actually searching against the `searchindex` table in the database. If you search that table, do you see the filename as a search keyword for what you're searching for? Also, what is the filename?  
  > **username_0**: @username_1 One file name is: "20180919-15472-993-vid-01.mp4"  Yes, when I search the searchIndex table "keywords contains" and type in the LogID "15472" I see them all.  Here's a screenshot: https://d.pr/i/gJfAS9 and here's a screenshot of the "craft_assets" table showing the files in both the local and S3 source folders: https://d.pr/i/baJRO4  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-12-07. Score: 1 | Accepted answer
  
  I figured it out. I was using folderID instead of volumeID. It looks like this parameter changed from Craft 2 to Craft 3.
  
  
  ---
  
  