Search Engine for CMSMS

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Brad Jones

Search Engine for CMSMS

Post by Brad Jones »

Hi Everyone

This isn't really module, I guess one day I could turn it into one but at the moment I can't be bothered. Anyway here is how I intergrated PHPDig in CMSMS.

Step 1:
Install PHPDig under

Code: Select all

/modules/PHPDig
Step 2:
Create User define tag called phpdig
With

Code: Select all

echo $_GET['query_string'];
Step 3:
Create Page called search
With



Also with in header

Code: Select all

{literal}
<__script__ type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</__script>
{/literal}
Step 4:
Insert this code wear every you want a search field. ie: Somewhere in your template.

Code: Select all

<form action="http://www.yoursite.com/index.php" target="_self" method="get">
<input type="hidden" name="page" value="Search">
<input type="text" name="query_string" value=""></td>
<input type="submit" name="Submit" value="Search">
</form>
Step 5:
I also create a link directly to http://www.yoursite.com/index.php?page=search
And name it Advanced search as you will then see the rest of PHPDigs functions.

Step 6:
Customise your own PHPDig template.
User avatar
petert
Power Poster
Power Poster
Posts: 282
Joined: Wed Feb 09, 2005 9:30 pm
Location: behind my desk

Re: Search Engine for CMSMS

Post by petert »

great stuff!
Finaly a search method that does real searching.

Implemented it today in udner half an hour. It works great!
Thanks!
Last edited by petert on Thu Dec 01, 2005 11:01 am, edited 1 time in total.
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!

CMSMS rules!
iNSiPiD

Re: Search Engine for CMSMS

Post by iNSiPiD »

Hi Brad,

Interesting stuff. Do you have a live example we can look at?

It was my understadning that phpDig had some loimiations with number of pages or something, or am I dreaming? A free and a commercial version?

Also, is the crawling and caching done elsewhere?
cyberman

Re: Search Engine for CMSMS

Post by cyberman »

Brad Jones wrote: Step 3:
Create Page called search
With

tag with stylesheets here. The tag is deprecated by W3C and should be only used for compatibiility with NS 1.1 ;-) .
Last edited by cyberman on Thu Dec 01, 2005 7:59 am, edited 1 time in total.
Brad Jones

Re: Search Engine for CMSMS

Post by Brad Jones »

To answer iNSiPiD's question, yes I do have a live version in fact I currently now have two sites using this method. Have a look at http://www.joneseng.com.au/ and also my personal site which is not quiet finished yet http://www.bjc.id.au/

Yes the admin of PHPDig is conducted from where you installed it so that would be:
http://www.yoursite.com/modules/PHPDig/admin/index.php

As far as I was aware there was only a free open source version but I guess I could be wrong.
iNSiPiD

Re: Search Engine for CMSMS

Post by iNSiPiD »

This seems to work really well, Brad. I love the relevancy of the results and the spelling suggestion on typos that near match keyowords in the spidered index.

wishy, if you're listening, could this be a viable solution as the defult search?

Could it be better integrated and installed/managed through admin?

I understand people would probably need to spider their site regularly but perhaps this, too, could be handled either by a button in admin search screem or in the bakcground with a cron job?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Search Engine for CMSMS

Post by Ted »

I think it's a nice solution in the interim.  However, I have some ideas to make it more integrated.  I would say try it for now and after we get 1.0 out the door, I'll start working on a new solution.  I think it's my first order of business for post 1.0...
User avatar
petert
Power Poster
Power Poster
Posts: 282
Joined: Wed Feb 09, 2005 9:30 pm
Location: behind my desk

Re: Search Engine for CMSMS

Post by petert »

iNSiPiD wrote: I understand people would probably need to spider their site regularly but perhaps this, too, could be handled either by a button in admin search screem or in the bakcground with a cron job?
It's already there, cron-jobs, 'wget jobs'. Comes standard with phpdig.
And it works great
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!

CMSMS rules!
iNSiPiD

Re: Search Engine for CMSMS

Post by iNSiPiD »

I think I just may be a very happy person now but the looks I'm currently getting from work colleagues suggests something else entirely. ;)

Thanks, petert. I'll have a play imminently!
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Search Engine for CMSMS

Post by Ted »

@Brad Jones, petert: Do you guys know if there is a way to use the internals of phpdig without the spider?  I'd love to be able to regster content with it instead of having to spider the pages.
User avatar
petert
Power Poster
Power Poster
Posts: 282
Joined: Wed Feb 09, 2005 9:30 pm
Location: behind my desk

Re: Search Engine for CMSMS

Post by petert »

wishy wrote: @Brad Jones, petert: Do you guys know if there is a way to use the internals of phpdig without the spider?  I'd love to be able to regster content with it instead of having to spider the pages.
I wouldn't take that aproach. Searching through the database is in my opinion not the best solution. I think that spiders always give you much better results (and all your modules and tags will work this way).

The 'old' cms I used (http://phpcms.de) had a spider and worked with flatfiles, perfect results from that search method.

Maybe some sort of hybrid form can be made? Each time a page is put in the cache it will automaticaly update the search results database through the logic of the phpdig spider?
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!

CMSMS rules!
iNSiPiD

Re: Search Engine for CMSMS

Post by iNSiPiD »

The spider multilists all the news links (possibly every instance for every page) so the results and indexing (keyword count) is screwed.

I wonder if there's a way to limit this with a regex in the spider admin.

Otherwise it works well enough, has good functionality and (once you've gone through the pain of installing PHPDig itself) integrating it into CMSMS is a piece of piss...er, really easy.
iNSiPiD

Re: Search Engine for CMSMS

Post by iNSiPiD »

I've fixed the spidering by excluding '&' from URL paths to search by. So now my site (with the exception of News and other module data) is all wonderfully spidered.

Experiment with the spider levels. Only go as deep as your menu structure. 3 or 4 generally seems more than adequate.

All in all a good solution for the interim.
shrewsbury

Re: Search Engine for CMSMS

Post by shrewsbury »

This is awesome, you rock!!!  Totally easy to set up and works like a charm.

;D
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Search Engine for CMSMS

Post by kermit »

a separate app for searching a db-driven web site, use of iframes? sorry, i don't see how that's "simple" compared to an internal search function that would utilize the db; something i'm surprised wasn't one of the first things added to cmsms. i was rather disappointed when i first saw that cmsms's "search" relied upon google's site-search.

don't get me wrong, it's great to see people adding functionality to cmsms, it's just that an internal search routine should be a core feature, not something you have to hack together.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
Locked

Return to “Modules/Add-Ons”