Making the block searchable

Permalink Browser Info Environment
You could make the block searchable by doing something along the lines of this:

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
Mnkras
View Replies:
mesuva replied on at Permalink Reply
mesuva
Thanks Mnkras, searching was something I neglected with this block. What I hadn't picked up was that the getSearchableContent function needs to be created to make it searchable, I just missed that aspect. Now that I know, it's pretty obvious.

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?
Mnkras replied on at Permalink Reply
Mnkras
nope, someone just needed it.
kdyer replied on at Permalink Reply
kdyer
So.. Are you going to add this functionality

Thanks,

Kent
mesuva replied on at Permalink Reply
mesuva
Yes, it's on my todo list! Probably next week.
mesuva replied on at Permalink Reply
mesuva
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?
Mnkras replied on at Permalink Reply
Mnkras
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:

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.