Making the block searchable
Permalink Browser Info Environment
You could make the block searchable by doing something along the lines of this:
I have not tested this, but it should work.
public function getSearchableContent() { $files = $this->getFileSet(); $search = ''; foreach($files as $f) { $fp = new Permissions($f); if ($fp->canRead()) { $fv = $f->getApprovedVersion(); $filename = $fv->getFileName(); $title = $f->getTitle(); $description = $f->getDescription(); $search .= $title.' '.$description.' '.$filename.'<br/>'; } } return $search; }
I have not tested this, but it should work.
Type: | Discussion |
---|---|
Status: | New |
nope, someone just needed it.
So.. Are you going to add this functionality
Thanks,
Kent
Thanks,
Kent
Yes, it's on my todo list! Probably next week.
Mnkras, I've got a quick question about this that I bet you'll be able to answer.
I've implemented your code, which worked fine, I've just added tags and the set title to the search text. Thanks for that.
I get search results for files using this if I make some change to the block and save the page it is on.
...But if I add a new file to the set using the file manager, I'm not able to search for it, even if I run the Automated Job to re-index the site. It's as if the search index job doesn't know the page needs re-indexing, even though the output of the block would have changed to output a new file.
So I guess my question is, do yo know if this this is a limitation of concrete5, or is there some other special function I should be using to indicate that this block should always be re-indexed?
I've implemented your code, which worked fine, I've just added tags and the set title to the search text. Thanks for that.
I get search results for files using this if I make some change to the block and save the page it is on.
...But if I add a new file to the set using the file manager, I'm not able to search for it, even if I run the Automated Job to re-index the site. It's as if the search index job doesn't know the page needs re-indexing, even though the output of the block would have changed to output a new file.
So I guess my question is, do yo know if this this is a limitation of concrete5, or is there some other special function I should be using to indicate that this block should always be re-indexed?
Thats a tricky one, and I'm not sure how to fix that off the top of my
head, can you post this in the leaders forum?
On Mar 2, 2012 12:27 AM, "concrete5 Community" <discussions@concretecms.com>
wrote:
head, can you post this in the leaders forum?
On Mar 2, 2012 12:27 AM, "concrete5 Community" <discussions@concretecms.com>
wrote:
I'll look at including this in my next release. I probably should add this to my other block as well.
Are you using this block for something?