homepage Welcome to WebmasterWorld Guest from 54.224.179.98
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Recommendations for site search
Gilead




msg:4400927
 4:35 pm on Dec 23, 2011 (gmt 0)

Forgive me if this is the wrong area to ask.
I'm looking for a PHP site search script that will search in one directory for xls, pdf, and metatags for pages corresponding to what the visitor is looking for. No need for database or flat files.

After much searching, I'm coming up empty. Any have some recommendations? Or any thoughts about building it myself?
Thanks Guys!

 

rocknbil




msg:4400933
 5:00 pm on Dec 23, 2011 (gmt 0)

Have you considered just integrating Google's site search (or one of the other S.E.'s free search tools?)

Gilead




msg:4401706
 3:09 pm on Dec 27, 2011 (gmt 0)

Would prefer to have the control a script offers, but thanks for the suggestion.

hazmat




msg:4401815
 10:40 pm on Dec 27, 2011 (gmt 0)

I've been using Sphinx search for quite some time. It's exceptionally fast and fairly easy to setup and configure. They've just released a new stable version with additional features.

topr8




msg:4401827
 11:05 pm on Dec 27, 2011 (gmt 0)

>>No need for database or flat files.

how is it going to work then? is the php script going to open every file to read the meta tags, read every pdf and excel document each time the search is initiated?

Gilead




msg:4401926
 3:08 pm on Dec 28, 2011 (gmt 0)

Okay, just my lack of experience talking. I had seen a couple that didn't use either flat or db.

Hazmat- I'll check it out. Thanks!

Gilead




msg:4401943
 5:15 pm on Dec 28, 2011 (gmt 0)

The server is not my own, and I do not have shell access. So Sphinx isn't going to work. Too bad, it looked like a good one. Any other thoughts?

hazmat




msg:4401971
 7:41 pm on Dec 28, 2011 (gmt 0)

How many files are we talking about on the server that will be indexed?

There are a couple of different options i can think of off the top of my head that will work pretty well.
I'm assuming this site isn't getting a lot of traffic and high performance isn't essential.

If it were just a small selection of xls and pdfs *filenames*, I'd probably just say to search on the fly. You could just readdir, then pattern match the filenames. I guess you could do the same with the html files, but as topr8 implied, reading that's going to be really slow for a moderate amount of results and not a good long term solution.

Best solution, because your search is so specific, it would be quite easy to create a database table, setup a script to load all of your files into the table, then use that on your search script.

Just create a table something like this:

id | search_term | uri

Setp a php script to index the files, and load it into your database, and maybe setup a cron to do this automatically.

Then perform your search on the database when your user searches, with a simple query such as:
$query = "SELECT uri FROM simple_site_search WHERE keyword LIKE '" . mysql_real_escape_string($keyword) . "'";
Or something like that, you probably get the idea.

HTH, let us know if you need more advice.

Gilead




msg:4402182
 3:33 pm on Dec 29, 2011 (gmt 0)

Thanks!

bkeep




msg:4403093
 5:03 am on Jan 3, 2012 (gmt 0)

Something I just ran across was glob [php.net...]

Gilead




msg:4403201
 4:18 pm on Jan 3, 2012 (gmt 0)

hmmm. Interesting.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved