Well, a search engine is not a trivial proposition. If you just have a few
hundred records without huge amounts of text, you can build SQL queries
and it's no big deal.

But if you expect it to scale, you need to turn the problem upside down 
and index the words. This means you build a table of words and a table 
that cross-references the word table to your text by saying which word 
appears at which position in which item. Every time you insert text, you 
update these other two tables accordingly. Then you can easily query 
against them to find any combination of words without waiting for it to 
crawl through all the text in your database. 

I don't know whether there's available PHP code, but it's a 
well-understood problem that has been solved countless times before, so 
you should be able to find a book that breaks it down into pseudocode you 
can rewrite as PHP. Or maybe you'll find something pre-made. How useful 
that will be depends on how peculiar your requirements are.

miguel

On Sat, 11 May 2002, SpamSucks86 wrote:
> I don't want to use a module though. I just want to take what a person
> types and parse it so I can put it into a mysql query and search my
> database of data. I share the server and I can't get mnoGoSearch
> compiled in with PHP, so unless there's PHP code I can borrow from it, I
> don't think it will help me.
> 
> -----Original Message-----
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> Sent: Saturday, May 11, 2002 2:23 PM
> To: SpamSucks86
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Search Engine With Boolean Support <--Please help
> 
> On Sat, 11 May 2002, SpamSucks86 wrote:
> > I need to have an internal search engine for my site. It needs to
> > support Boolean (not, or, and). Are there any fairly simple scripts
> out
> > there that will help me with this? Even if it's just to give me an
> idea
> > of where to start. I'm using mySQL, and Boolean support isn't
> > implemented until v4.0. Thanks for any and all help! =)
> 
> Have a look at http://mnogosearch.ru/
> 
> and the accompanying functions in the PHP manual.
> 
> miguel
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to