NYCPHP Meetup

NYPHP.org

[nycphp-talk] Search function

David Krings ramons at gmx.net
Fri Sep 19 21:32:06 EDT 2008


(Margaret) Michele Waldman wrote:
> Thank you for your input.
> 
> I went to google.  Basically you need an xml file and some html.  They
> didn't break it down simply enough, but it was simply enough to figure out
> with slightly little effort.
> 
> Swish-e is not breaking through clearly enough quick enough for me.  Can you
> break down the general idea?
> 
> It's looking like perl calls.  Is this the case?

As far as I recall there are two ways. You can either execute an ad-hoc search 
and swish-e goes and digs through the files, or you can have it update a site 
index on a schedule and then execute searches against that index. I found it 
to be quite fast when I used it last and that was even by having swish-e 
create a temporary file (I think) that I then read in via PHP. The index works 
OK unless you have so many changes going on on your site that the reindexing 
would need to take place every minute and tie up resources.

The site where I used it on is still up and you can give it a try. Go to 
http://irsupport.net/search/search.htm and search for the word "lock". You get 
an excessive amount of hits and yet the page still loads quickly. I may have 
the code floating around somewhere, but would need to search for it. I did 
this years ago when I started with PHP and found it quite easy after figuring 
out the command line parameters for swish-e. That site runs on WAMPP.

Well, I did have a good idea where I might have a backup of that code and I 
did find it. See the attached archive. It contains the search entry page as 
well as the script that executes the search against the index and then 
generates the results. I only looked at the first few lines, but it should be 
well commented.

The documentation for how to create the index files is here: 
http://www.swish-e.org/docs/swish-run.html

HTH,

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: search.zip
Type: application/x-zip-compressed
Size: 3802 bytes
Desc: not available
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080919/73223675/attachment.bin>


More information about the talk mailing list