Searching 'Channel Files' possible?
Hi,
I have an intranet with a massive amount of files that have been uploaded using 'Channel Files'. The client wants to be able to search for files (by file name). Does Low work with Channel Files in this way?
Replies
Low 13 Jan 2015 08:25
That depends on what Channel Files stores in the native exp_channel_data table. There isn't specific support for Channel Files in LS, but that shouldn't be necessary if it stores searchable data in said table.
If you send me a copy, I can check that out for you.
ZEDG 13 Jan 2015 10:15
Thanks for the reply.
I have no idea how CI stores the info. Did you require a copy of the db in order to check?
Low 13 Jan 2015 10:24
Or just send me your copy of CI so I can see for myself.
ZEDG 13 Jan 2015 10:30
Thanks, i have just emailed you the zip.
I think it would be good to know for any other EE/CF users whether Low allows for searching of CF files.
Low 13 Jan 2015 10:50
Looks like the answer is No. It just stores the string "ChannelFiles" in the database, making the files not searchable (not only by LS, but even the native search can't search through it).
DevDemon should take a look at this API to add support for it, or just put all its searchable data in the channel_data table, which will make it searchable, too.
ZEDG 13 Jan 2015 11:25
Ok thanks.
I cant believe CF doesn't support searching!
Todd Richards 27 Jul 2016 14:15
Sorry for piggybacking on this but I didn't want to start another thread regarding the same topic since this was over a year old. Has anything changed that could enable searching the titles of Channel Files? Low, I found your Low Search Members extension and was looking to modify it to search the channel_files table instead of the members table (and link the entry_ids). However, I wasn't sure if this would even work.
Low 27 Jul 2016 14:23
Nothing changed on my end, anyway. CF needs to return searchable data for Low Search to use.
The Low Search Members filter works differently, as that allows you to target specific fields in the exp_members table. I take it you want the content that is stored in the Channel Files field to be searchable via the Keywords filter, which means that data needs to somehow be added to the search index.
The API still is in place if DevDemon should want to use it.
ZEDG 27 Jul 2016 14:26
Brad at DevDemon support ended up being very helpful in providing the solution to searching Channel Files.
(I told him to add it in the CF documentation.)
His last email to me (which was specific to me and should help you):
First the form:
http://par.sc/1b9UF/15rnbkVU
The Results Template
http://par.sc/16OUv/3gBIglC1
The ONLY thing you need to change is the field_id. You get this here:
http://par.sc/DXHi/1LYCz5mz
I would probably use some Javascript to not allow any spaces in the field.
Low 27 Jul 2016 14:29
Note that the above solution only searches the channel files themselves, not the entries associated with those files.
Also, it might be prone to SQL injection, by the looks of it. I would not recommend that approach, unless you do some serious filtering of the {post:keywords} variable on the back-end first.
Todd Richards 27 Jul 2016 14:52
Thank you both. I will look at the solution provided above (thanks ZEDG). And thank you Low for your response. The search is on an attorney's members-only site, so while I'm less concerned about that I would certainly make sure proper filtering was considered.
Ideally, someone could type in a term and it would search not only the fields in the channel entries but also the related titles field of the entries in the channel_files table. That's why I was hoping that the Low Search Members filter would allow me to do that with changes to the params as well as to the tables being called.
Low 27 Jul 2016 14:55
That's where changing the Low Search Members filter will not help. A separate filter will make available some new parameters to use, eg. member:email="foo". Using one parameter/field for searching (most likely name="keywords") will require the searchable data to be incorporated into the search index, for which the fieldtype will need to use the API.
Todd Richards 27 Jul 2016 14:57
OK, got it. My backup plan is to add the file title to a special "keywords" custom field that can be searched. I was hoping to avoid this but it might be the best option at this time. Thanks again Low!