Blogs Made Simple - Searchable by the Search Module - Help Please

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
chandu
New Member
New Member
Posts: 7
Joined: Thu Mar 26, 2009 10:17 pm

Blogs Made Simple - Searchable by the Search Module - Help Please

Post by chandu »

Hello,
(I searched the forums but couldn't find anything to address this.)

I am using CMS 1.5.3

Posts in Blogs Made Simple are not being indexed for the search. Is it possible to have them indexed by the Search module?

I see that the description for the Search module says "core" content along with certain modules. But then it doesn't say which ones or how to find out which ones are supported.

If it is possible to have the posts from Blogs Made Simple indexed in the search, what do I have to do?

Thanks for any help.
Last edited by chandu on Mon Mar 30, 2009 3:47 am, edited 1 time in total.
chandu
New Member
New Member
Posts: 7
Joined: Thu Mar 26, 2009 10:17 pm

Re: Make Blogs Made Simple Searchable by the Search Module

Post by chandu »

Thanks for the response.
mark wrote: I believe you can target a module specifically, look in search Help for parameters...
I tried doing that with the "module" parameter.

In the Help is says:
(optional) modules="null" - Limit search results to values indexed from the specified (comma separated) list of modules.

So I tried {search modules="Blogs"}

Still didn't work. Any other ideas?

I'm thinking that the Blogs module is not by default index-able by the search module. But I would think that there was a way to do it. I could be wrong.
chandu
New Member
New Member
Posts: 7
Joined: Thu Mar 26, 2009 10:17 pm

Re: Make Blogs Made Simple Searchable by the Search Module

Post by chandu »

So anyone have any ideas for this?
chandu
New Member
New Member
Posts: 7
Joined: Thu Mar 26, 2009 10:17 pm

Re: Blogs Made Simple - Searchable by the Search Module

Post by chandu »

If the default Search Module cannot search the Blogs, is there another option?
AlienatedNZ
New Member
New Member
Posts: 4
Joined: Mon Nov 03, 2008 11:10 pm

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by AlienatedNZ »

Anyone have an answer yet?
bullitshot
Forum Members
Forum Members
Posts: 57
Joined: Mon Mar 23, 2009 11:35 am

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by bullitshot »

Hello!

I am having the same problem. I have tried a lot of things but it just won't work.

Anyone got an idea?

Is there another search module for cmsmadesimple?

thanks!!
chandu
New Member
New Member
Posts: 7
Joined: Thu Mar 26, 2009 10:17 pm

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by chandu »

I'm going to guess that it's not possible. I hope I'm wrong.
But if it's a matter of the module having to "register" with the search module, does anyone know what that would entail?

Is getting the Blogs Made Simple module registered with the Search module a difficult task?
khalistoo

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by khalistoo »

Same here, i having the same problem but i don't think it should be an issue in the module behavior to actually indexed the content of another module such as Blogs, if anybody from the dev team of this project have a need of info or anything please feel free to ask
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by Jeff »

Yes it can be done, it is a few line hack that you have to put into the code, since hacking the code will stop the forum from being able to help you, I would suggest you take a look at CGBlog which has that built in.

Take a look at CGBlog (that will give me time to look it up) and if you still want to hack the code I will tell you where.

Jeff
pawel
New Member
New Member
Posts: 2
Joined: Wed May 20, 2009 11:22 am

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by pawel »

Hi,
I have the same problem and I´d like to stay with Blogs Made Simple. Can you pls put here the code and explian how to fix this problem?
Thx very much, P.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by Jeff »

In /modules/Blogs/action.addentry.php replace line 90 with the following.

Code: Select all

  if ($result) 
  {
    $message["module_message"]=$this->Lang("newentryadded"); 
    //Update search index
    $module =& $this->GetModuleInstance('Search');
    if ($module != FALSE)
    {
      $content = '';
      $content .= $text.' '.$title.' '.$title;
      $module->AddWords($this->GetName(), $entryid, 'blogentry', $content, NULL);
    }
  }
  else 
  {
   $message["module_error"]=$this->Lang("entryaddederror");
  }
I updated my BlogMS versions so I lost what I had originally. This adds it to the search module database but I can't figure out why the search form won't return the item.

Warning... This is hacking the module files and making the change will make them nolonger be supported.
pawel
New Member
New Member
Posts: 2
Joined: Wed May 20, 2009 11:22 am

Re: Blogs Made Simple - Searchable by the Search Module - Help Please

Post by pawel »

To return and show results in search form insert  in /modules/Blogs/Blogs.module.php this code at the end of file (before the last "}"):

Code: Select all

function SearchResult($returnid, $articleid, $attr = '')
    {
      $result = array();
		
      if ($attr == 'blogentry')
	{
	  $db =& $this->GetDb();
	  $q = "SELECT title FROM ".cms_db_prefix()."module_blogs_entries WHERE
		        active = 1 AND id = ?";
	  $dbresult = $db->Execute( $q, array( $articleid ) );
	  if ($dbresult)
	    {
		
	      $row = $dbresult->FetchRow();

	      //0 position is the prefix displayed in the list results.
	      $result[0] = $this->GetFriendlyName();
		
	      //1 position is the title
	      $result[1] = $row['title'];

	      //2 position is the URL to the title.
	      
	      $aliased_title = munge_string_to_url($row['title']);
	      $prettyurl = 'Blogs/' . $articleid.'/'.$returnid."/$aliased_title";
	      $result[2] = $this->CreateLink('cntnt01', 'detail', $returnid, '', array('articleid' => $articleid) ,'', true, false, '', true, $prettyurl);

	    }
	}
		
      return $result;
    }

    function SearchReindex(&$module)
    {
      $db =& $this->GetDb();
		
      $query = 'SELECT * FROM '.cms_db_prefix().'module_blogs_entries';
      $result = &$db->Execute($query);

      while ($result && !$result->EOF)
	{
	  if ($result->fields['active'] == '1')
	    {
	      $module->AddWords($this->GetName(), 
				$result->fields['id'], 'blogentry', 
				$result->fields['title'] . ' ' . $result->fields['text'],
				NULL);
	    }
	  $result->MoveNext();
	}
    }
and instert at the end of function DeleteEntry this code:

Code: Select all

     //Update search index
    $module =& $this->GetModuleInstance('Search');
    if ($module != FALSE)
      {
	$module->DeleteWords($this->GetName(), $entryid, 'blogentry');
      }
This works for me with two limitations. The first one - the comments are not indexed and searchable, and the second one - if a blogentry is deactivated, search db must be reindexed in admin Search module menu to obtain correct results.
Locked

Return to “Modules/Add-Ons”