Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Mambo Bridge Support => Topic started by: bmwheaven on March 25, 2005, 03:46:38 PM

Title: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on March 25, 2005, 03:46:38 PM
Here it is, the search function combined for mambo, smf and coppermine (in the mambo-wrapper component).
You can put this code in your mambo template (index.php).
You'll get a search box, together with a selection box, where you can select which part of the site you want to search on.

code (for in index.php in your mambo template):
NOTE: you have to add a wrapper in your com_wrapper admin, point it to http://yoursite.com/gallery/thumbnails.php and call it cpg_search

//put this in between the <head></head> tags
<script language="JavaScript">
<!--
function processForm()
{
f = document.searchform;
switch (f.searcharea.selectedIndex)
{
// mambo
case 0: f.method='post';
f.action='index.php?option=search';
break;
//smf
case 1: f.method='post';
f.action='index.php?option=com_smf&Itemid=51&action=search2';
f.search.value=f.searchword.value;
f.option.value="";
break;
//coppermine
case 2: f.method='get';
f.action='index.php?option=com_wrapper&wrap=cpg_search&album=search&type=full';
f.search.value=f.searchword.value;
f.option.value = "com_wrapper";
f.wrap.value = "cpg_search";
break;
}
f.submit();
}
-->
</script>

//put this in the place you want the searchbox to display
<form name='searchform' action='javascript:processForm()' method='post'>
            <div class="searchblock" id="searchblock">
              <input size="15" class="inputbox" type="text" name="searchword" style="width:128px;" value="search..."  onblur="if(this.value=='') this.value='search...';" onfocus="if(this.value=='search...') this.value='';" />
              <input type="hidden" name="option" value="search" />
  <input type="hidden" name="wrap" value="cpg_search" />  
  <!--cpg-->
  <input type="hidden" name="album" value="search" />
  <input type="hidden" name="search" />
  <!--end cpg-->
 
  <!--smf-->
  <input type="hidden" name="advanced" value="0" />
  <!--end smf-->
 
              <select name="searcharea">
                <option value = 0>Articles</option>
                <option value = 1>Forum</option>
                <option value = 2>Image Gallery</option>
              </select>
              <br>
              <input type="submit" value="GO" class="button" style="width:35px;" />
            </div>
          </form>



Hope I've told everything, you can always ask!
Thanks to Orstio for helping :)

Ilir
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Janner on March 27, 2005, 02:58:39 AM
Presumably this line has to be changed to reflect the itemid of your own installation:

f.action='index.php?option=com_smf&Itemid=51&action=search2';
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on March 27, 2005, 06:51:16 AM
yep, sry... forgot that....
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: deejayh on April 05, 2005, 05:30:21 AM
Hi,

Does this only work in a wrapped SMF Forum and wrapped Coppermine -  On my site they are UN-WRAPPED,

Dave
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: jorgen on April 05, 2005, 10:56:50 AM
Could this be made an a mambo-module for easier installation?

And can it easily be customized for Mambo-smf only?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on April 07, 2005, 12:22:13 PM
Quote from: deejayh on April 05, 2005, 05:30:21 AM
Hi,

Does this only work in a wrapped SMF Forum and wrapped Coppermine -  On my site they are UN-WRAPPED,

Dave
You can modify them easily for an unwrapped coppermine, just change this line in case 2:
//coppermine
case 2: f.method='get';
f.action='index.php?option=com_wrapper&wrap=cpg_search&album=search&type=full';
f.search.value=f.searchword.value;
f.option.value = "com_wrapper";
f.wrap.value = "cpg_search";
break;

to
//coppermine
case 2: f.method='get';
f.action='/coppermine/thumbnails.php&album=search&type=full';
f.search.value=f.searchword.value;
f.option.value = "";
f.wrap.value = "cpg_search";
break;


for smf you have to search the values for the form, I don't know them...


Quote from: jorgen on April 05, 2005, 10:56:50 AM
Could this be made an a mambo-module for easier installation?

And can it easily be customized for Mambo-smf only?
customizing for mambo-smf only is easy, just delete (or comment out) the things you dont need, for example:
//put this in between the <head></head> tags
<script language="JavaScript">
<!--
function processForm()
{
f = document.searchform;
switch (f.searcharea.selectedIndex)
{
// mambo
case 0: f.method='post';
f.action='index.php?option=search';
break;
//smf
case 1: f.method='post';
f.action='index.php?option=com_smf&Itemid=51&action=search2';
f.search.value=f.searchword.value;
f.option.value="";
break;
}
f.submit();
}
-->
</script>

//put this in the place you want the searchbox to display
<form name='searchform' action='javascript:processForm()' method='post'>
            <div class="searchblock" id="searchblock">
              <input size="15" class="inputbox" type="text" name="searchword" style="width:128px;" value="search..."  onblur="if(this.value=='') this.value='search...';" onfocus="if(this.value=='search...') this.value='';" />
              <input type="hidden" name="option" value="search" />
  <!--smf-->
  <input type="hidden" name="advanced" value="0" />
  <!--end smf-->
 
              <select name="searcharea">
                <option value = 0>Articles</option>
                <option value = 1>Forum</option>
              </select>
              <br>
              <input type="submit" value="GO" class="button" style="width:35px;" />
            </div>
          </form>


This should work...
Didn't test it though, let me know

Owh, and to the question if this could be made a module, probably it could, but really don't know how exactly...
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: deejayh on April 17, 2005, 11:58:51 AM
Hi,

I have the normal Mambo search in my index.php.
I would like to add an "advanced Search" link to go to a "static page" where this code would go to search:
1)  Mambo
2) SMF
3) some other components (such as "classifieds") which do not yet have a mambot search!

Could this be achieved?

Regards,
Dave
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on April 19, 2005, 10:22:07 AM
You can create a custom page in mambo, and put in the search code I used for the module...
You can use a static content page, and paste in the html/javascript code provided, shouldn't be too difficult.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: deejayh on April 19, 2005, 03:38:38 PM
Hi bmwheaven,

Do you mean the module that is in the bridge files?

Dave
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Kindred on April 19, 2005, 04:19:20 PM
Actually, Adding your code into the search module does not work....

Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on April 19, 2005, 04:52:45 PM
Nope, I meant adding the code into a seperate file, through your admin, select Content->Static Content Manager
Then add new, and put the code in there...
On the right side you can make a direct link (Link to Menu), so that the link to this search page will be displayed in the menu you choose.
Hope this helps, I really gotta get some sleep.
nn
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: deejayh on April 28, 2005, 05:25:47 AM
Sorry to trouble you again!

What about a SMF search Mambot?

So it would be a straight forward search.
It seems there are loads of people adding search mambots for their components.

I would not know where to start though! :)

Just a thought!
Dave
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on April 28, 2005, 05:49:07 AM
Hey Dave,
it sounds really good, I know.. but I really don't have the time to build it, and don't know how to (yet)...
Maybe someone else would like to look into it?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: deejayh on April 28, 2005, 09:29:20 AM



anyone willing to have a go at this?

Upto the challenge?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: NoRad on May 04, 2005, 05:53:32 AM
I too am looking for integrated search in mambot form.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: d3v on May 21, 2005, 05:54:14 AM
Did anyone ever pick this up?
SMF Searchbot for Mambo sounds soooo good  :P
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: d3v on May 24, 2005, 12:33:39 AM
I swear I saw something like that on one of the Mambo sites. Am I day dreaming or such a thing exists in nature? Thank you.

I refer to just Mambo-SMF search bot. not Coppermine
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on May 24, 2005, 06:13:03 PM
I haven't got a clue....
I just wrote it, because I didn't find anything that suited my needs....
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: chadness on May 27, 2005, 11:53:02 AM
Ideally it would be two different bots.  One for SMF, one for Coppermine.  No need to mix them - then people can just install what they need.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: d3v on May 30, 2005, 07:05:22 AM
Is it possible to make this without the dropdown box (Articles/Forum) but rather just one search box that would search both and show results for both on the same page? Thank you.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: bmwheaven on May 30, 2005, 11:08:05 AM
Quote from: d3v on May 30, 2005, 07:05:22 AM
Is it possible to make this without the dropdown box (Articles/Forum) but rather just one search box that would search both and show results for both on the same page? Thank you.
Might be possible... but don't know how...
Probably with a bot, but don't have the time to find out.
The drop-down works fine for me, don't have enough knowledge bout mambo/smf... sry
Title: Searchbot for SMF
Post by: rjprince on July 29, 2005, 03:48:13 PM
I've made three searchbots, and am willing to write one for SMF. However, if someone could point me to some SMF development resources, it would save me a lot of time. What I need:

1.) I use Mambo's built-in db functions for accessing the database. I will need a pointer to a quick overview on SMF's. Basically, how is prexif substitution handled, does SMF automatically escape quote characters, etc.? Just one example of a function that makes a db call will probably suffice or the filename and line number of such a function.

2.) The names of the tables and fields to be searched. My first cut would just search posts, not events or calendar items, so I assume subject, thread title, and post content would be the fields I need. If someone can point me to an ERD or a data dictionary, I can find what I need.

3.) How to link to specific posts within a thread - preferably an API function to do so

I'm sure I could figure this out, but I first looked at SMF yesterday. If someone can point me to these items, I have a good shot at getting a version out by the end of the weekend.

Basically, I'm proposing I take advantage of someone else's expertise in SMF so I can use my knowledge of searchbots to get this out quickly.

Thanks!
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on July 29, 2005, 07:11:44 PM
Thanks for taking the time to look into this, Rjprince.

If you download the bridge package, there is a folder called "misc modules".  In it you will find a module called "Related Topics", that searches SMF's messages for items related to the current article.  That should help you with all three of your concerns.  ;)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 30, 2005, 12:45:02 AM
OK, I've got a basic start working. If you want to see it working, check out www. princeclan.org. Type in some search term about Harry Potter - it's the only thread active right now on my site. Technically it's a private forum, so SMF won't let you into the posts, but you can see what the results look like.

There a couple of problems:

1.) I included $db_prefix in the globals declaration, but it didn't have a value. I've hardcoded it for now, but obviously that's undesirable. How does $db_prefix get its value? It's possible search mambots run before the smf code that sets it is run, in which case we might have trouble with this.

2.) Is there a quick rundown on how you all do the date/time fields? I need to know:
    a. if I can sort on the int fields you use as dates to get get correct date ordering and
    b. how to format the date.
Quick pointer to code should be all I need.

3.) Possibly much bigger deal: I'd like the search to respect current permissions. Is there a way in SQL code to select boards based on the current user's permissions? The query for the boards to show would probably

4.) To implement that, I'm assuming I'll need the smf member ID. Again, quick pointer to code that checks to see if anyone is logged in and retrieves the ID would be great.

Again, if you guys don't know this stuff off the top of your head, I can dig for it. But it's always easier to ask the developers.

If all goes well, I'll release this as an early test tomorrow night. 3 and 4 are pretty much showstoppers for me, and 2 is just ugly right now. I will need testers with more substantial numbers of posts and hopefully someone who has mambo and smf in separate databases. So let me know if you want to try it and I'll PM you the link to the code late tomorrow night.

There are 3 display elements in a mambot search results list: title (which is the link to the item - I'm using the subject of the message plus the memberName of the poster), section (the name of the board), and description (the title of the first message in the topic plus the first 200 letters of the post). Suggestions on these elements are welcome.

And please disregard the ugliness. I'll be retheming later. :)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: [Unknown] on July 30, 2005, 12:56:07 AM
Quote from: rjprince on July 30, 2005, 12:45:02 AM
1.) I included $db_prefix in the globals declaration, but it didn't have a value. I've hardcoded it for now, but obviously that's undesirable. How does $db_prefix get its value? It's possible search mambots run before the smf code that sets it is run, in which case we might have trouble with this.

I think it may be in the mos_smf.php configuration file... I'm afraid I'm not sure though, and am more responding to your other questions.

Quote2.) Is there a quick rundown on how you all do the date/time fields? I need to know:
    a. if I can sort on the int fields you use as dates to get get correct date ordering and
    b. how to format the date.
Quick pointer to code should be all I need.

They're just unix timestamps.  They're ascending by time (0 = December 31, 1969...) but so are the ids (ID_MSG, etc. start at 1 = earliest and go up by time) which is what I would strongly recommend sorting on (much faster.)

To format the date, you can either use PHP's time functions (strtotime(), time(), etc. - it's just seconds so arithmetic is easy) or MySQL's, FROM_UNIXTIME() and UNIX_TIMESTAMP().

It's really not meant to be complicated ;).

Quote3.) Possibly much bigger deal: I'd like the search to respect current permissions. Is there a way in SQL code to select boards based on the current user's permissions? The query for the boards to show would probably

Indeed, this might be more complicated.  You can find the code used in Load.php, search for query_see_board.  As long as the boards table is aliased as "b", this query will check basic permissions for you.  To see if they can reply, etc... is a bit more complicated.

Quote
4.) To implement that, I'm assuming I'll need the smf member ID. Again, quick pointer to code that checks to see if anyone is logged in and retrieves the ID would be great.

Again, yes, this is all stuff that needs SMF.  You might try using SSI.php (which will give you everything you need, and access to $ID_MEMBER, $user_info, allowedTo(), etc.), which may not conflict with things as long as the search you're writing and SMF do not show on the same page at once.

-[Unknown]
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on July 30, 2005, 06:23:22 AM
Quote1.) I included $db_prefix in the globals declaration, but it didn't have a value. I've hardcoded it for now, but obviously that's undesirable. How does $db_prefix get its value? It's possible search mambots run before the smf code that sets it is run, in which case we might have trouble with this.

Grr...This is because Mambo goes through all the bot code first, before reading the template.  You're probably best including $mosConfig_live_site/administrator/components/com_smf/config.smf.php and then including $smf_path/Settings.php.  That should give a definition for $db_prefix.

QuoteQuote
4.) To implement that, I'm assuming I'll need the smf member ID. Again, quick pointer to code that checks to see if anyone is logged in and retrieves the ID would be great.

Again, yes, this is all stuff that needs SMF.  You might try using SSI.php (which will give you everything you need, and access to $ID_MEMBER, $user_info, allowedTo(), etc.), which may not conflict with things as long as the search you're writing and SMF do not show on the same page at once.

I've tried calling SSI.php from a mambot before, and it creates problems.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: flirby on July 30, 2005, 09:44:56 AM
Hi All,

I am trying to implement the form / script to get this working and when I try searching the forum I always get the following mambo page error: "The page you are trying to access does not exist.
Please select a page from the main menu. "
But if I enter the action in the case statement (I have added my com_smf id) into the browser it always comes up with the correct search page.

Any clues anyone?  Code below...



<script language="JavaScript">
<!--
function processForm()
{
   f = document.searchform;
   switch (f.searcharea.selectedIndex)
   {
   // mambo
   case 0: f.method='post';
         f.action='index.php?option=search';
         break;
   //smf
   case 1: f.method='post';
         f.action='index.php?option=com_smf&Itemid=631&action=search2';
         f.search.value=f.searchword.value;
         f.option.value="";
         break;
   //coppermine
   case 2: f.method='get';
         f.action='index.php?option=com_wrapper&wrap=cpg_search&album=search&type=full';
         f.search.value=f.searchword.value;
         f.option.value = "com_wrapper";
         f.wrap.value = "cpg_search";
         break;
   }
   f.submit();
}
-->
</script>
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 30, 2005, 10:12:16 AM
QuoteTo format the date, you can either use PHP's time functions (strtotime(), time(), etc. - it's just seconds so arithmetic is easy) or MySQL's, FROM_UNIXTIME() and UNIX_TIMESTAMP().

It's really not meant to be complicated  ;).

I'm a recovering Microsoft programmer; patience is needed. That worked fine - Mambo reformats it to Mambo's setting, so consistency is maintained.

QuoteGrr...This is because Mambo goes through all the bot code first, before reading the template.  You're probably best including $mosConfig_live_site/administrator/components/com_smf/config.smf.php and then including $smf_path/Settings.php.  That should give a definition for $db_prefix.

There were serious problems with this. Because SSI.php uses require_once() for settings, including it in the mambot kept SSI.php from loading it. Because the mambot is not running in the global context, this did Bad Things, even when I did the include outside the mambot function.

The only combination I found that works is to change the code required in the template to this:

if (!defined('SMF')){
  require ("administrator/components/com_smf/config.smf.php");
  [b]require($smf_path . "/Settings.php");[/b]
  require ($smf_path."/SSI.php");
}


This new line will add the settings whether they have been loaded or not; SSI won't load it again, so everyone is happy. We'll just have to include this modification to the template in the mambot instructions and, possibly, in the readme for installing the bridge itself once the mambot is release-ready.

I didn't tackle the security issue yet. Since SSI definitely does not like to be included in the Mambots, this may not be possible. I may have to extract the loadUserSettings() and some of the settings from SSI - something that will be horrible to maintain. I'll think more on this later.

Thanks for your help. I'll get back to this tonight and hopefully post an initial version.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: [Unknown] on July 30, 2005, 10:36:07 AM
Quote from: Orstio on July 30, 2005, 06:23:22 AM
Grr...This is because Mambo goes through all the bot code first, before reading the template.  You're probably best including $mosConfig_live_site/administrator/components/com_smf/config.smf.php and then including $smf_path/Settings.php.  That should give a definition for $db_prefix.

That won't quite work because Settings.php is included with include_once(), you'd have to global everything.

Quote
I've tried calling SSI.php from a mambot before, and it creates problems.

I see; I didn't realize they were all loaded before anything else, that's definitely a problem.

If you include SSI.php, you will have $user_info['query_see_board'] at your disposal, from that function.

-[Unknown]
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on July 30, 2005, 11:52:37 AM
QuoteThis new line will add the settings whether they have been loaded or not; SSI won't load it again, so everyone is happy. We'll just have to include this modification to the template in the mambot instructions and, possibly, in the readme for installing the bridge itself once the mambot is release-ready.

I've actually been toying with a method of eliminating the Mambo template code fix altogether.  It wouldn't modify Mambo at all, and would allow people to switch templates without having to add the code into each template they try.

There is a small race condition issue I have to work out with it first, and then it will be released with the next version.  I can modify that to what you have suggested to eliminate any problems with your bot (and possibly in the discussbot as well.)  ;)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 30, 2005, 05:30:55 PM
OK, I've gotten somewhere,  but I want to run this by you all because it may be a security issue.

Because the mambots are run when they are, I cannot access SSI. I've tried almost every combination of require/include I could think of and am pretty sure it's not meant to be.

So, I took the loadUserSettings function from Load.php and cut it down to just what I needed. It works on my site, but one thing concerned me. The function references $modSettings['integrate_verify_user'], modSettings['integrate_verify_user'], !empty($modSettings['disableCheckUA']. As best I can tell, none of these are set by the time the mambot is called.

Does this pose a security risk?

If not, the rest is straightforward. Once I have the  value of ID_MEMBER, do I need to check anything besides is_activated to see if that user is allowed to see these boards?

I've duplicated a bit of business logic, something I hate doing for mods, but it's pretty clean once these questions are answered. I don't anticipate too much of a problem keeping it in synch with SMF and the bridge as they are upgraded, but it won't be as easy as it could have been had SSI worked.

For reference, here's the query I'm using to conduct the search.

SELECT CONCAT(m.subject, ' by ', u.memberName) AS title,
FROM_UNIXTIME(m.posterTime, '%Y-%m-%d %H:%i:%s') as created,
  CONCAT('In topic "', tm.subject, ':" ', LEFT(m.body, 200), IF(CHAR_LENGTH(m.body) > 200, '...', '')) as text,
b.name as section,
CONCAT('/index.php?option=com_smf&Itemid=83&', 'topic=', m.ID_TOPIC, '.msg', m.ID_MSG, '#msg', m.ID_MSG) AS href,
'2' AS browsernav
FROM smf_pc_messages as m INNER JOIN smf_pc_topics as t ON m.ID_TOPIC = t.ID_TOPIC
INNER JOIN smf_pc_messages as tm ON t.ID_FIRST_MSG = tm.ID_MSG
INNER JOIN smf_pc_boards as b ON t.ID_BOARD = b.ID_BOARD
INNER JOIN smf_pc_members as u ON m.ID_MEMBER = u.ID_MEMBER
WHERE ( (m.subject LIKE '%Neville%' OR m.body LIKE '%Neville%')
OR (m.subject LIKE '%Herb%' OR m.body LIKE '%Herb%') )
AND (FIND_IN_SET(9, b.memberGroups) OR
FIND_IN_SET(4, b.memberGroups) OR
FIND_IN_SET(13, b.memberGroups) OR
FIND_IN_SET(17, b.memberGroups) OR
FIND_IN_SET(19, b.memberGroups) OR
FIND_IN_SET(23, b.memberGroups))
ORDER BY m.ID_TOPIC DESC


I will ask that someone familiar with good security practices in smf take a look at the mambot before general release.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on July 30, 2005, 05:40:17 PM
[Unknown] would be best to ask about the security.

I have a request, however:  Can you change the "&"s in the URLs to "&amp;" ?  I'd like to use this, but I want to maintain my XHTML compliance.  ;)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 30, 2005, 05:50:46 PM
Done. It should be noted that I copied and pasted that line from the related items misc mambot.  :P
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: [Unknown] on July 30, 2005, 09:42:02 PM
Quote from: rjprince on July 30, 2005, 05:30:55 PM
So, I took the loadUserSettings function from Load.php and cut it down to just what I needed. It works on my site, but one thing concerned me. The function references $modSettings['integrate_verify_user'], modSettings['integrate_verify_user'], !empty($modSettings['disableCheckUA']. As best I can tell, none of these are set by the time the mambot is called.

Those three are all usually-not-set settings.  The first and second can be reasonably assumed to either be Mambo, or not set.  The third will almost never be set, and is just an option in case anyone has problems.  So far, no security risk that I see.

Quote
I've duplicated a bit of business logic, something I hate doing for mods, but it's pretty clean once these questions are answered. I don't anticipate too much of a problem keeping it in synch with SMF and the bridge as they are upgraded, but it won't be as easy as it could have been had SSI worked.

I agree it would be nicer if SSI.php worked.  Technically speaking, nothing in the license allows you to copy out the code, but I think we can let it slide for now as long as you acknowledge somewhere in the file it's in that some code came from SMF - is that okay?

SELECT CONCAT(m.subject, ' by ', u.memberName) AS title,
FROM_UNIXTIME(m.posterTime, '%Y-%m-%d %H:%i:%s') as created,
  CONCAT('In topic "', tm.subject, ':" ', LEFT(m.body, 200), IF(CHAR_LENGTH(m.body) > 200, '...', '')) as text,
b.name as section,
CONCAT('/index.php?option=com_smf&Itemid=83&', 'topic=', m.ID_TOPIC, '.msg', m.ID_MSG, '#msg', m.ID_MSG) AS href,
'2' AS browsernav
FROM smf_pc_messages as m INNER JOIN smf_pc_topics as t ON m.ID_TOPIC = t.ID_TOPIC
INNER JOIN smf_pc_messages as tm ON t.ID_FIRST_MSG = tm.ID_MSG
INNER JOIN smf_pc_boards as b ON t.ID_BOARD = b.ID_BOARD
INNER JOIN smf_pc_members as u ON m.ID_MEMBER = u.ID_MEMBER
WHERE ( (m.subject LIKE '%Neville%' OR m.body LIKE '%Neville%')
OR (m.subject LIKE '%Herb%' OR m.body LIKE '%Herb%') )
AND (FIND_IN_SET(9, b.memberGroups) OR
FIND_IN_SET(4, b.memberGroups) OR
FIND_IN_SET(13, b.memberGroups) OR
FIND_IN_SET(17, b.memberGroups) OR
FIND_IN_SET(19, b.memberGroups) OR
FIND_IN_SET(23, b.memberGroups))
ORDER BY m.ID_TOPIC DESC


Assuming you use the query_see_board there, and have some way of obtaining the db_prefix (and that neither of those are insecure) this looks fine.  I'll assume that you are escaping the search string, yes?

At one point in the future, perhaps when we've resolved some other issues (like the SSI one), it may be a good idea to use FULLTEXT and some other things for the searching.

Let me ask you this: if you change both require_once's of Settings.php to require's (SSI.php and index.php) does everything work fine to use it?

-[Unknown]
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 30, 2005, 10:06:50 PM
QuoteTechnically speaking, nothing in the license allows you to copy out the code, but I think we can let it slide for now as long as you acknowledge somewhere in the file it's in that some code came from SMF - is that okay?

Sorry about that. I'll add a comment to that section. My intent is to get this working and then turn it over to you guys, but the mambot section is taken from a GPL piece of code.

It would not be hard to rewrite that section if you wish to include it as part of the distribution.

Here's the comment I added in the derived function:

// The code in this function is derived from function loadUserSettings() in source/Load.php.
// Used by permission of [Unknown] at http://www.simplemachines.org/community/.
// Use of Simple Machines Forum is subject to the license agreement with which it is distributed.
/******************************************************************************
* Load.php                                                                    *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel ([email protected])                *
* =========================================================================== *
* Software Version:           SMF 1.1 Beta 3 Public                           *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by:     Lewis Media (http://www.lewismedia.com)         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/


QuoteI'll assume that you are escaping the search string, yes?

Yes. I use mambo's database functions, which handle escaping. To test, I've done several searches with single quotes in them. It actually overescapes.

QuoteAt one point in the future, perhaps when we've resolved some other issues (like the SSI one), it may be a good idea to use FULLTEXT and some other things for the searching.

I'd love to, but my host doesn't support it yet. Hopefully by the time this comes up, I will and then I'll update it.

QuoteLet me ask you this: if you change both require_once's of Settings.php to require's (SSI.php and index.php) does everything work fine to use it?

Yes, it seems to. I didn't test that thoroughly, because the method I'm using worked without requiring a change to a core file.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 30, 2005, 10:27:50 PM
Here's version 0.1 of a searchbot for smf. (http://www.princeclan.org/staticcontent/smf.search.zip)

BE SURE TO READ THE POST TWO SPOTS BELOW FOR INSTRUCTIONS FOR MODIFYING YOUR TEMPLATE TO USE THE MAMBOT!

Simply install it in the mambo admin mambot screens. Be sure to publish it and make the change described two posts below to your template's index.php file. It's an all-forum search of the message text and body. It respects user permissions. It is not meant to duplicate advanced search in smf, but to allow an integrated search function with mambo. In mambo, search results are grouped by content type; to move forums up or down in that list, change the order of the searchbot in mambo admin.

Please test. I especially need tests across multiple forums, with varied permissions by user. Try to crash it with bad search strings.

Comments on output would be appreciated - specifically, what should be the link text, the section header, and the description.

If anyone is using different databases, I need that checked as well. And people who didn't install mambo in the root and smf in the "forum" directory, along with combinations of SEF on and off.

Please post comments and suggestions here.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on July 31, 2005, 09:23:15 AM
 :(

It kills the Who's Online 2 module:

QuoteWarning: main(/QueryString.php): failed to open stream: No such file or directory in /home/everythi/public_html/components/com_smf/SSI.php on line 55
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on July 31, 2005, 12:39:43 PM
THIS POST ONLY APPLIES TO THE MAMBO SEARCHBOT MENTIONED TWO POSTS ABOVE. IT IS NOT GENERAL ADVICE FOR ANYTHING ELSE.

You need to update the code in the index.php file for your active template:

global $sc, $context;

if (!defined('SMF')){
  require ("administrator/components/com_smf/config.smf.php");
  // ADD THE LINE BELOW
  require ($smf_path . "/Settings.php");
  require_once ($smf_path."/SSI.php");
}

$sc = &$context['session_id'];
$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];

mysql_select_db($mosConfig_db);


Everything but the comment line and the line below should already be there. You're just adding the line " require ($smf_path . "/Settings.php");"


I mentioned this above but forgot to add this to the instructions. I'll edit that post.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on July 31, 2005, 05:03:55 PM
Thanks, I completely forgot about that.

I am actually not using the code in the header of the template (I mentioned a different method earlier), but I did get this working very well.

Great work!  :D
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: djpillo on August 01, 2005, 07:33:35 PM
can someone help me....because i CANT DO it....agggggggggg

I have Copermine Bride SMF and a SMF bridge Mambo.
I have do a WRAP in Manbo to COpermine.

This is that i do:(rjprince post)

1) i install the SMF.SEARCH in  "Mambots"
2) I edit the "index.php" of my template:; require ($smf_path . "/Settings.php"); (when rjprince  say)

What i am doing wrong?

Thanks
SORRY FOR MY ENGLISH
---------------------------------------------------------------------------------
EDIT

I HAVE DO ITTTTTTTTTTTTTTTTTTTTTTTT!!! jeejejeje SORRY
i have been lost to PUBLISH the smf.search!!!!

Now it work fine.

Can Someone say me how do for COpermine?
Thanks
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Aravot on August 01, 2005, 07:43:47 PM
You want to wrap Coppermine in Mambo?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 01, 2005, 08:12:37 PM
djpillo, unless you were installing the mambo searchbot mentioned just a few posts up, that change is unnecessary - although it shouldn't hurt anything, either.

I have no idea how the searchbot works in an unwrapped site, but it works fine in a wrapped site.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: jorgen on August 02, 2005, 05:30:49 AM
Quote from: rjprince on July 30, 2005, 10:27:50 PM
Here's version 0.1 of a searchbot for smf. (http://www.princeclan.org/staticcontent/smf.search.zip)

rjprince,
It works perfect for me. Now I can finally get rid of my second search-box on my site, and have one single box that searches the entire site.

Thanks a lot for making this mambot.

Orstio: Maybe you could upload this bot to mamboforge? (I think most people would like to use this bot instead of the search-module I made).
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: [Unknown] on August 02, 2005, 06:00:11 AM
Quote from: rjprince on July 30, 2005, 10:06:50 PM
Here's the comment I added in the derived function:

I don't personally think that's necessary.  As long as you're using it with SMF, this seems perfectly fine:

// The code in this function is derived from function loadUserSettings() in Sources/Load.php.
// Used by permission of [Unknown] at http://www.simplemachines.org/community/.
// Use of Simple Machines Forum is subject to the license agreement with which it is distributed.


I'll have to consider making the Settings.php inclusion a direct include.  I can see the benefits, but it's also supposed to be only included once (in case you add things in there, which you should be able to... hmm.)

-[Unknown]
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 02, 2005, 09:17:42 AM
I'm perfectly willing to turn this over to you all at this point. It is GPL because it's based on other GPL search mambots from which I copied and pasted. I suspect most of the changes that will be needed are smf-specific, so someone here will be in a better position to make them. Just leave a reference to me in the comments at the top, if you would, and I'll be perfectly happy.

It still needs lots of testing, obviously, especially with different configurations - wrapped/unwrapped, same db, different db. I just remembered that the URL generated is specific to a wrapped site with my itemid for the menu, so I do need to figure out how to generate the URL in a  generic fashion.

Thanks for everyone's help with this, and for putting out such a good forum.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: jorgen on August 02, 2005, 12:09:22 PM
Rjprince,
No need to tutn this searchmambot-project over to anyone. But If you give a notice to Orstio everytime you make a new version, I'm sure he'll upload it to the usercreated module-section: http://mamboforge.net/frs/?group_id=543

It is just a convinient way for users to access all modules in one convinient place.   8)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 02, 2005, 08:37:54 PM
Version .2 is uploaded, same link. I changed the comments per [Unknown]'s last post and also fixed it so it should work in wrapped or unwrapped situations. Here's the code that sets the base URL (config.smf.php and Settings.php are both loaded and appropriated variables declared global.):

if ($wrapped) {
mysql_select_db($mosConfig_db);

$database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=com_smf'");

$myurl = $_SERVER['PHP_SELF'] . "?option=com_smf&amp;Itemid=" . $database->loadResult() ."&";
} else {
$myurl = $boardurl . "/index.php?";
}


I can verify it works on my wrapped site. I assume the DB code is correct for retrieving the Itemid on other wrapped sites, because it's not hard-coded here.

What I can't test is the unwrapped portion (the line after the else). It's pretty straightforward code, and it returns a URL that looks right, but I haven't tested it.

I also added a readme file describing the changes to index.php and warning in the install to make the changes in the readme file.  :-[

I considered making substitutions for the [] codes in the portion of text displayed by the search results. However, I decided against it because I did not want to leave unclosed tags if only part of a tagged section got included. So the user sees the actual [] codes, not formatted text.

I don't think this is worth fixing, unless someone knows of a way to do so easily. So as of now, I consider this feature-complete and simply awaiting more testing on as many different configurations as possible. Then we can make it beta.

Feel free to post it at MF if you want.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on August 02, 2005, 08:57:31 PM
QuoteVersion .2 is uploaded, same link. I changed the comments per [Unknown]'s last post and also fixed it so it should work in wrapped or unwrapped situations. Here's the code that sets the base URL (config.smf.php and Settings.php are both loaded and appropriated variables declared global.):

I think you have misinterpreted the meanings of wrapped, unwrapped, and stand-alone.

Wrapped:  Inside the Mambo template
Unwrapped:  Still used as a Mambo component, with a Mambo URL, but looks stand-alone
Stand-Alone:  Not really integrated with Mambo, uses standard URL.

That said, the url, even if $wrapped = false, should point to the ?option=com_smf link.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 02, 2005, 09:10:39 PM
Oh. Then nobody download it until I can fix it.

I assumed. :(
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 02, 2005, 09:14:02 PM
OK, fixed. Safe to download again.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: stephenvb on August 09, 2005, 08:49:08 PM
Quote from: rjprince on July 30, 2005, 10:27:50 PM
If anyone is using different databases, I need that checked as well. And people who didn't install mambo in the root and smf in the "forum" directory, along with combinations of SEF on and off.

Please post comments and suggestions here.

I can't get any results from my forum.  It is a separate database, wrapped installation of SMF.  I installed the mambot, revised the template index.php and published the mambot.  Is there anything else I need to do to get it to see the forum database?  criticaldetroit.org (http://criticaldetroit.org)

(I assume from looking at the bots, that this one runs first, followed by all the other search bots.)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on August 09, 2005, 09:32:33 PM
Hmm... some of this is derived from SMF 1.1 beta 3.  Has anyone else tested it on SMF 1.0.x?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Aravot on August 09, 2005, 09:35:56 PM
Quote from: Orstio on August 09, 2005, 09:32:33 PM
Hmm... some of this is derived from SMF 1.1 beta 3.  Has anyone else tested it on SMF 1.0.x?

Not me
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 09, 2005, 10:43:40 PM
Quote from: stephenvb on August 09, 2005, 08:49:08 PM
Quote from: rjprince on July 30, 2005, 10:27:50 PM
If anyone is using different databases, I need that checked as well. And people who didn't install mambo in the root and smf in the "forum" directory, along with combinations of SEF on and off.

Please post comments and suggestions here.

I can't get any results from my forum.  It is a separate database, wrapped installation of SMF.  I installed the mambot, revised the template index.php and published the mambot.  Is there anything else I need to do to get it to see the forum database?  criticaldetroit.org (http://criticaldetroit.org)

(I assume from looking at the bots, that this one runs first, followed by all the other search bots.)

1. Did you go in and publish the bot? I've found that sometimes I need to go into the mambot form itself, instead of clicking the x in the list.

2. Try turning on debug mode an copy and paste the SQL statement that looks like the one I listed earlier in the thread. This will also print a warning if the SQL is bad.

If the bot generates bad SQL, it doesn't raise an error outside debug mode.

If you try 1 and it doesn't work, post the info from 2 and I'll look at it tomorrow.

BTW, I don't intend to make this work with 1.0x if that's the problem, although I'll be happy to help someone else adapt it if they need mambo help. I don't have any means to test, and it's just to frustrating to develop that way.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: stephenvb on August 10, 2005, 08:41:05 AM
Quote from: rjprince on August 09, 2005, 10:43:40 PM
1. Did you go in and publish the bot? I've found that sometimes I need to go into the mambot form itself, instead of clicking the x in the list.

2. Try turning on debug mode an copy and paste the SQL statement that looks like the one I listed earlier in the thread. This will also print a warning if the SQL is bad.

If the bot generates bad SQL, it doesn't raise an error outside debug mode.

If you try 1 and it doesn't work, post the info from 2 and I'll look at it tomorrow.

BTW, I don't intend to make this work with 1.0x if that's the problem, although I'll be happy to help someone else adapt it if they need mambo help. I don't have any means to test, and it's just to frustrating to develop that way.

I've published the module as indicated above and it didn't help.  I did turn on debug and got the following information:

Search Keyword belle
Notice: Table 'critica3_mamb1.smf_members' doesn't exist in /home/critica3/public_html/includes/database.php on line 221

/home/critica3/public_html/includes/database.php:405
/home/critica3/public_html/mambots/search/smf.search.php:151
/home/critica3/public_html/mambots/search/smf.search.php:102
/home/critica3/public_html/includes/mambo.php:2939
/home/critica3/public_html/components/com_search/search.php:105
/home/critica3/public_html/components/com_search/search.php:18
/home/critica3/public_html/index.php:182
Notice: Table 'critica3_mamb1.smf_messages' doesn't exist in /home/critica3/public_html/includes/database.php on line 221

/home/critica3/public_html/includes/database.php:405
/home/critica3/public_html/mambots/search/smf.search.php:105
/home/critica3/public_html/includes/mambo.php:2939
/home/critica3/public_html/components/com_search/search.php:105
/home/critica3/public_html/components/com_search/search.php:18
/home/critica3/public_html/index.php:182returned 0 matches


If this is an issue with using SMF 1.0.x, should I upgrade to the beta version?  Is there a problem with the SMF installation?  I've seen simliar errors with some modules (SMF Recent Topics, SMF Whos Online2) that I couldn't get to work either.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 10, 2005, 09:45:12 AM
I can't speak to whether you should upgrade or not, but the search bot has only been tested on the beta version.

A couple of quick questions:

1.) Is critica3_mamb1 the name of the DB where SMF is located? My site has both in the same, and if I screwed up the db it would explain a lot.

2.) Is smf_ the prefix for your smf tables? I assume so, because it's not mine, so it must be pulling it from somewhere correctly. But let's double check.

For the devs: did the data structure change between versions? The problem here would be the messages and members tables, it appears. If not, then it's probably a databse name issue.

If I get the answer to these two questions before 8 tonight, I'll take a quick look and see if the I'm switching the db correctly. It's possible that the mambo db function switches the db back without my knowing it; if so, I can fix that pretty easily.

One other thing you could try, if your comfortable running queries on MyPHPAdmin or something similar, is to copy the SQL from the debug output and try running it directly in the appropriate db. If that works, we'll have narrowed the problem down to the database and we'll have a good idea that it['s likely to work with the stable version.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: stephenvb on August 10, 2005, 09:59:59 AM
Quote1.) Is critica3_mamb1 the name of the DB where SMF is located? My site has both in the same, and if I screwed up the db it would explain a lot.

critica3_mamb1 is the separate database for the Mambo installation.  The separate SMF database is critica3_smf1 (on my installation).

Quote2.) Is smf_ the prefix for your smf tables? I assume so, because it's not mine, so it must be pulling it from somewhere correctly. But let's double check.

Looking through the SMF database, it appears that smf_ is the prefix for all the tables.  (Note:  SMF was installed from Fantastico on my host and this is the way they were installed.)

QuoteOne other thing you could try, if your comfortable running queries on MyPHPAdmin or something similar, is to copy the SQL from the debug output and try running it directly in the appropriate db. If that works, we'll have narrowed the problem down to the database and we'll have a good idea that it['s likely to work with the stable version.

You've lost me here.  (I'll admit to not knowing much about the "magic" behind SMF and Mambo)  If you need this information you'll have to walk me through it.  Sorry.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 10, 2005, 11:27:34 AM
Don't worry about it. It's not necessary - the db name is definitely a problem, and hopefully the only one.

Once I make the change, we can find out if it works under the stable version or only the new beta.

Either way, this has to be fixed, so I'll look at it tonight.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: jorgen on August 10, 2005, 12:49:16 PM
Quote from: Orstio on August 09, 2005, 09:32:33 PM
Hmm... some of this is derived from SMF 1.1 beta 3.  Has anyone else tested it on SMF 1.0.x?

I've installed it on my live site (1.0.5, see signature) AND my local test site (1.1b3).

The bot seems to work fine in both!    :D
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 10, 2005, 01:44:18 PM
Excellent. Then I'll fix the multi-db problem and we should be good to go. :)

I'd like to hear from everyone else about a week after I fix this. Hopefully we'll be ready to go alpha at that point.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 10, 2005, 09:55:01 PM
OK, 0.3 is up. I can't test the two-DB functionality, but it definitely pulls the db_name from the SMF settings.php file, so I don't see any reason it wouldn't work.

stephenvb, can you please download and test?

After stephenvb reports back (assuming success), I'm going to ask that everyone who's been testing to download the new version to test it again.

BTW, can I say I hate how PHP handles variable scoping. Hate. Hate. Hate.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: stephenvb on August 10, 2005, 10:36:36 PM
Yay!  It works!

(one small comment)  It displays the username instead of the name from SMF in the results, but can it just display the title (which would be consistent with the rest of the results) followed by the place?  Say remove "by cdadmin" from first result to be consistent with second result.

QuoteNational Trust list entire Detroit Region by cdadmin   (Other Related)
In topic "National Trust list entire Detroit Region:" In a rare move, the National Trust for Historic Preservation has listed the entire Detroit region as one of America's 11 Most Endangered Hist ...
05 August, 2005

Historic Detroit Neighborhoods (FAQs/Reference Information)
Have you ever wondered just where a certain neighborhood is located within Detroit?  We've got the answer!  Thanks to CityScapeDetroit for creating this map and allowing us to host a copy he ...
09 August, 2005

Great work though!  This adds so much value to my fledgling site.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 10, 2005, 10:53:51 PM
Ah, my forum only displays the usernames, so I didn't even think of that as an option.

I see members.userName, members.realName, and messages.posterName. Can anyone point me to a quick rundown as to what is what?

If I'm just displaying a user name as the author of a message, is it safe to just use message.posterName?

Just saw your edit:

I could do that, but it's kind of useful on my site. Maybe I'll make it an mambot parameter.

But later. :)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: [Unknown] on August 10, 2005, 11:24:45 PM
Quote from: rjprince on August 10, 2005, 10:53:51 PMI see members.userName, members.realName, and messages.posterName. Can anyone point me to a quick rundown as to what is what?

Err memberName you mean?  That's their username for logging in.  It really shouldn't be displayed anywhere.  The realName is their "real" displayed name.  That's the one to use.  The posterName is for guests and deleted members - it's set for everyone, but should only be shown if a matching ID_MEMBER members row is not found.

Quote from: rjprince on August 10, 2005, 10:53:51 PMIf I'm just displaying a user name as the author of a message, is it safe to just use message.posterName?

Not so much.  For one thing, they could have changed their name since posting.

-[Unknown]
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 11, 2005, 09:16:51 AM
QuoteErr memberName you mean?

Err, yes, that's what I meant.

QuoteThe realName is their "real" displayed name.  That's the one to use.  The posterName is for guests and deleted members - it's set for everyone, but should only be shown if a matching ID_MEMBER members row is not found.

OK, easy change. I'll put in COALESCE(members.realName, message.posterName); that should do it.

I can't promise when the parameter for displaying or not will be added tonight, though. Depends on how much I want to procrastinate on other stuff. :D
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 11, 2005, 09:54:40 PM
OK, I fixed which member names are being used as described above. I also turned the INNER JOIN connecting the member table into a LEFT JOIN so that deleted members won't keep a post from appearing in search. I also coalesced most of the display strings so there wouldn't be blank entries on the search results.

It's uploaded to my site (same link as above) as version 0.4.

I did not add a parameter to leave off the member name. I found a usability issue and I'd like input from the folks testing it before I make more changes.

The searchbot currently searches the body and the subject for the search text. The problem is, the default subject for replies is Re: <original subject>. This means that for every topic with the search text in the title, almost every post will appear in the search results. There are a few possibilities here:

1.) Only search subjects that don't match "Re: <original subject>" (I have access to the original subject for each result post). Upside: fairly simple to implement. Still returns multiple posts per thread if search text is in the posts. This is good if the thread is long and the search text isn't in most of the posts in the thread. Bad otherwise.

2.) Only return one result per topic, no matter how many posts match. Upside: Still fairly simple to implement, shouldn't hurt performance too much. Returns only one post per thread, which means in really long threads you still have to search manually.

3.) Something I haven't thought of but hopefully someone here will. :)

I know how I'll go about implementing either solution. What I need now are preferences and reasons for the preferences.

I also need people to download the new version and test it, preferably someone with some deleted users and people using alternate screennames to see if it works.

Thanks for any input - I even thank the bug finders. :)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: stephenvb on August 11, 2005, 10:03:28 PM
Alternate screen names appear to be working.   (At least for me)
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: [Unknown] on August 12, 2005, 01:01:36 AM
If you only want to search topic subjects, you'll want to do it based on ID_FIRST_MSG, not whether Re: is there - for internationalization reasons.

SMF's search lists one result per topic, but may list multiple quotes from multiple posts in the topic which match.

-[Unknown]
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: d3v on August 13, 2005, 08:19:04 AM
Had to change couple of small things but I have this working on

Mambo 4.5.2.3
SMF 1.0.5

Thank you for this
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 13, 2005, 10:29:52 AM
QuoteHad to change couple of small things but I have this working on

Mambo 4.5.2.3
SMF 1.0.5

What did you have to change? If we need to fork the versions, I'd like to make those changes available to others. I wrote if for Mambo 4.5.2.3 and SMF 1.1 beta 3, and I know at least one other person is using it for SMF 1.05 (don't know his Mambo version).

QuoteIf you only want to search topic subjects, you'll want to do it based on ID_FIRST_MSG, not whether Re: is there - for internationalization reasons.

I'd actually like to search message subjects that are different from the topic subject, so using ID_FIRST_MSG won't help. Assuming "Re:" is identifiable in the language files, I'll use that for the comparison.

"Re:" isn't a setting by any chance, is it?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 13, 2005, 12:43:23 PM
Found "Re:" in index.english.php. Not sure if it's worth the trouble to implement this part, because I don't have access to Load.php and would have to figure out the best way to pull in this value without it.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 20, 2005, 03:28:35 PM
Version 0.5 of the searchbot is available at http://www.princeclan.org/component/option,com_docman/Itemid,91/

I modified the searchbot to not search the default subjects added to replies. If ANY change has been made to the default subject, then the subject is searched.

I could not get Load.php to load correctly without doing bad things to the site. So I compromised: the setting is in a variable which can be edited. If I add interactive settings, I'll make this an option that can be set from the admin panel.

However, this works well enough. Here are the directions from the readme file:

If you are not using the default English language files, you need to
modify the following lines in smf.search.php:

   // EDIT THIS LINE TO MATCH THE $txt['response_prefix'] = ENTRY IN YOUR LANGUAGE FILE index.english.php
   $response_prefix = 'Re: ';

Change the value of $response_prefix to the value of $txt['response_prefix'] in the index.<language>.php file.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: rjprince on August 20, 2005, 05:02:44 PM
On thing I forgot to add:

Could some users please run some searches and report number of messages in their DB, number of results, and time to create the page (using the mambo page time code that's out there)?

I have no sense of how well this scales, but it's doing substring searches without full text indexing, so I'm thinking it's going to slow down at some size.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: tempest2000 on December 03, 2005, 10:37:21 PM
hi,
thanks for the plugin but i am having trouble installing it.

it seems to successfully upload the mambo and puts it in the list, but has no info next to it, and a message at the top saying:

Warning: file_get_contents(/home/httpd/vhosts/ourdomain.co.uk/httpdocs/mambots//search/smf.search.readme.txt.xml): failed to open stream: No such file or directory in /home/httpd/vhosts/ourdomain.co.uk/httpdocs/includes/domit/xml_domit_lite_parser.php on line 1031

If I change smf.search.xml in /httpdocs/mambots/search/ to smf.search.readme.txt.xml, it seems to read the info correctly and the error does not appear. the mambot seems to be installed. i also made the template change just before exactly as described.

however, i try various searches which i know will have results, and it does not come up with any smf posts.

any ideas rjprince?

thanks again!
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: tempest2000 on December 03, 2005, 10:46:06 PM
hmm, i changed smf.search.php to smf.search.readme.txt.php too and it all seems to work now - lots of results from the forum.

just as a further development: is it possible to add more radio paramaters to the search so that it can exclude forum posts etc. mambo articles now seem to get lost in all the forum results and it would be nice if people could have a bit more control of the results.

thanks again.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Sven0 on December 15, 2005, 02:17:15 PM
i get this error:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 12 bytes) in /usr/local/vhosts/httpd/htdocs/mambots/search/smf.search.php on line 193

how can i solve that?

Update: set the memory_limit = 16M in the php.ini, but:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 515 bytes) in /usr/local/vhosts/httpd/htdocs/includes/joomla.php on line 4635

also if i try to search a non-existing word like asdfffssffs this error occurs:


Warning: main(/QueryString.php): failed to open stream: No such file or directory in /usr/local/vhosts/httpd/htdocs/forum/SSI.php on line 55

Fatal error: main(): Failed opening required '/QueryString.php' (include_path='.:') in /usr/local/vhosts/httpd/htdocs/forum/SSI.php on line 55
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Sven0 on December 16, 2005, 04:19:54 AM
ok i deinstalled it and installed mod_smf_search_1.1b3.zip

but here is also an error, the URL is displayed as /index.php?option=com_smf&Itemid=198&?action=search2 with this error:

Query error, press Retry to continue if it doesnt continue automatically

the right URL would be without the ? before action=search2

how can i delete the ? in the script?

Update: found it in ssi.php
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: zigzag on January 04, 2006, 07:14:55 AM
Quote from: tempest2000 on December 03, 2005, 10:37:21 PM
hi,
thanks for the plugin but i am having trouble installing it.

it seems to successfully upload the mambo and puts it in the list, but has no info next to it, and a message at the top saying:

Warning: file_get_contents(/home/httpd/vhosts/ourdomain.co.uk/httpdocs/mambots//search/smf.search.readme.txt.xml): failed to open stream: No such file or directory in /home/httpd/vhosts/ourdomain.co.uk/httpdocs/includes/domit/xml_domit_lite_parser.php on line 1031

If I change smf.search.xml in /httpdocs/mambots/search/ to smf.search.readme.txt.xml, it seems to read the info correctly and the error does not appear. the mambot seems to be installed. i also made the template change just before exactly as described.

however, i try various searches which i know will have results, and it does not come up with any smf posts.

any ideas rjprince?

thanks again!
hmm, i changed smf.search.php to smf.search.readme.txt.php too and it all seems to work now - lots of results from the forum.

just as a further development: is it possible to add more radio paramaters to the search so that it can exclude forum posts etc. mambo articles now seem to get lost in all the forum results and it would be nice if people could have a bit more control of the results.

thanks again.

Hi,

I installed the mambot on a test site (different server) and had the same problem as Tempest2000 so I renamed the files as Tempest did and it worked fine (I'm using separate databases too).
So I did the exact same thing on my live site and got error messages so I uninstalled the mambot  and then everything on the site stopped working and I was prompted to download index.php on every link I clicked on  :o  Then for some unknown reason the site started working again but all the Joomla files had become unwritable.  Would this be caused by the mambot or is it likely to be a coincidence and something wrong on the server side? I want to get the search bot working but I'm a bit nervous to try it again so just wondered if anyone else had had the same problem.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: zigzag on January 04, 2006, 07:48:06 AM
Ignore the previous post, I just found out that my hosts have had a major problem with the server and  are in the process of fixing it, so it was just coincidence that I happened to be installing the search bot at the same time  :D
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: ljk on November 15, 2006, 05:30:09 PM
I am running Joomla 1.0.11 and SMF 1.1 RC3. I just installed smf.search.alpha 0.5. I added the required code in the top of my Joomla template file as instructed in the readme file.

Now in the administrtor side of things when I try to edit any mambot I get an error message "Restricted Access" and the mambot is left locked.

The Joomla search box does not seem to return any forum topics either.

Any suggestions?
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Orstio on November 15, 2006, 05:43:51 PM
QuoteI am running Joomla 1.0.11 and SMF 1.1 RC3. I just installed smf.search.alpha 0.5.

I believe you need to be using 0.6 for SMF 1.1RC3.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: imrich on November 26, 2006, 05:30:14 PM
Maybe this will save someone else some time.

I have Joomla 1.0.11 and SMF 1.1.RC3 and the 1.16 bridge.

I tried the search bridged smf forums mambot ( smf.searchbot.0.6.zip ) from www.princeclan.org and couldn't get it to work.

Here's what I did to fix it.

1) create a copy of smf.searchbot.0.6.zip
2) In the copy I deleted the file smf.search.readme.txt
3) In the copy, edit the file smf.search.xml and delete the line that contains:

<filename mambot="smf.search.readme.txt">smf.search.readme.txt</filename>

4) In your Joomla Administration panel, installers->mambots browse to the location of your fixed copy of smf.searchbot.0.6.zip and then choose to Upload File & Install it.
5) Under your mambots-> site mambots menu, be sure that the "Search Bridged SMF Forums" is published.

Thats it, now go to your Joomla home page and test the search function, it should now find items in the forum as well as your Joomla content.

I hope this helps someone. I stumbled on this for a bit but finally figured it out.




Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: imrich on January 24, 2007, 05:03:59 PM
I just found my first 'bug' or issue with this searchbot.

I have SMF 1.1.1
Joomla 1.0.12
bridge 1.1.6

It's been working perfectly from the user front end.

However, from the admin backend of Joomla, if you use the :

Site -> Statistics -> Search Text admin tool it looks OK,

but THEN! Press the [Show Search Results] button and I recieve the following error repeated a few to many times:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/user/domains/mydomain.tld/public_html/mambots/search/smf.search.php on line 188


Line 188 appears to be just a simple:

mysql_select_db($db_name, $db_connection);


I'm not sure what pressing the [Show Search Results] button could be doing to mess up this search bot, but it is.

I'm using separate databases for my smf and joomla.  But this has been working perfectly until I stumbled on this issue.

If anyone has a clue to this, I'd appreciate some help.
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: Kindred on January 24, 2007, 06:19:55 PM
the smf header bot is not initialized in the backend...   which means that SMF's SSI is not run, so the search routine has not idea what the variables $db_name or $db_connection are...
Title: Re: Search in mambo/smf-forums/coppermine-gallery
Post by: imrich on January 25, 2007, 07:52:04 AM
Kindred,

Thanks for this clue. I'm still learning SMF and Joomla coding, can you give me a hint of what to look for so I can fix this?

This is a great addition for those who have bridged joomla.

I now have SMF bridged to joomla as well as Coppermine (with Stramm modpack). After fixing these errors my next step is to work on a coppermine search bot (which was started in this thread.