Page 1 of 1
Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Thu Mar 26, 2009 10:35 pm
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.
Re: Make Blogs Made Simple Searchable by the Search Module
Posted: Thu Mar 26, 2009 11:46 pm
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.
Re: Make Blogs Made Simple Searchable by the Search Module
Posted: Sun Mar 29, 2009 8:23 pm
by chandu
So anyone have any ideas for this?
Re: Blogs Made Simple - Searchable by the Search Module
Posted: Mon Mar 30, 2009 3:47 am
by chandu
If the default Search Module cannot search the Blogs, is there another option?
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Mon Mar 30, 2009 9:49 pm
by AlienatedNZ
Anyone have an answer yet?
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Wed Apr 01, 2009 12:31 pm
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!!
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Thu Apr 02, 2009 5:23 am
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?
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Sun May 17, 2009 10:34 pm
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
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Mon May 18, 2009 8:09 am
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
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Wed May 20, 2009 11:28 am
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.
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Fri May 22, 2009 12:48 am
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.
Re: Blogs Made Simple - Searchable by the Search Module - Help Please
Posted: Mon Jun 01, 2009 8:33 pm
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.