Lucene query for querying file asset

27 views
Skip to first unread message

trinity trinity

unread,
May 8, 2023, 8:08:42 AM5/8/23
to dotCMS User Group
Hello Everyone. 

I am trying to get a file asset from File Asset structure by its path using below query

+contentType:FileAsset +(conhost:SYSTEM_HOST) +live:true +path:*/foldername/filename.pdf*  

But this query is not returning any result. But for the given path I ve an file asset . Please let me know how to pull up a file asset content from File Asset structure using its path value

Thanks in Advance

 



Mark Pitely

unread,
May 8, 2023, 10:48:25 AM5/8/23
to dot...@googlegroups.com
That probably won't work; this is very dependent on what version you are running, as older versions did have a folder path and actual legacy files. 
Here's a query from the most recent version: (searching for 'contains detail')
+contentType:FileAsset  +title:'detail'^15 +deleted:false +working:true 

I think that when you are referring to files, though, the 'folder' is not text-searchable, you need to get the folder identifier ( +conFolder:513aec5b\-3aaa\-4df2\-b306\-83e77ba334d9)
Obviously, if you have the option, use the 'Search' feature and use the 'show query'. 
Sorry I can't be more precise - this can really be a pain. 

Mark Pitely
Albright College

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/6244f69a-f3ff-460d-90b1-7a583f9854f0n%40googlegroups.com.

trinity trinity

unread,
May 8, 2023, 2:16:34 PM5/8/23
to dotCMS User Group
Thanks Mark. 

I have only path for the document  which includes file name and parent folder ,  from which  I need to get the file asset content. Is there any other way to get it using just relative path for a document from root folder

Mark Pitely

unread,
May 8, 2023, 3:42:22 PM5/8/23
to dot...@googlegroups.com
Maybe? I should have been more explicit before; what version of dotCMS are you running? How it works changes quite a bit!
Also, remember that dotCMS runs on a virtual file platform - there is no 'root folder' or 'path' you can't think of this like a flat-file /var/www thing. 
You can probably find the folder ID by looking at the folder in the tree-browser and clicking on the folder. 

M

Reply all
Reply to author
Forward
Message has been deleted
0 new messages