RE: Advanced search scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you're looking at a PHP only solution, then you've got to build an
engine that'll parse the search text, i.e. separate the quoted areas,
the +words, -words, etc and form that into a usable SQL query. As for
the table you search, using LIKE would be horribly slow on a large
table, so you'll probably have to build a "keyword" table and relate
each keyword back to the original table it was in. Then you'd search on
these keywords. 

It would probably be better and faster to use a database solution, i.e.
fulltext indexing in MySQL. It already supports searching with +word and
-word, not sure about quotes, though. I'm sure other databases have
their own method of doing this and I'm sure it would be faster overall
because the database knows where everything is at and you don't have to
build a "keyword" table.

My $0.02.

---John Holmes...

> -----Original Message-----
> From: Adam Royle [mailto:ifunk@myrealbox.com]
> Sent: Wednesday, October 09, 2002 6:54 AM
> To: holmes072000@charter.net
> Cc: php-db@lists.php.net
> Subject: Re:  Advanced search scripts
> 
> Well, for this example, you could use mySQL, but really, I would be
> looking to utilise this on any database. Personally, I don't think
this
> would be database dependent (unless you have other ideas).
> 
> Adam
> 
> On Wednesday, October 9, 2002, at 08:46  PM, John W. Holmes wrote:
> 
> > What database are you using?
> >
> > ---John Holmes...
> >
> >> -----Original Message-----
> >> From: Adam Royle [mailto:ifunk@myrealbox.com]
> >> Sent: Wednesday, October 09, 2002 2:09 AM
> >> To: php-db@lists.php.net
> >> Subject:  Advanced search scripts
> >>
> >> I was wondering if anyone has some resources (links or scripts) on
> >> 'advanced site searches'. Something that is similar to the way
regular
> >> search engines process requests.
> >>
> >> ie.   "phrase or two" word +required -"not included"
> >>
> >> Also, returning details of that search, say for example returning
10
> > words
> >> before and 10 words after and displaying it in search results. The
> > ability
> >> to search similar words (eg. ignoring punctuation) would be cool
> > aswell.
> >>
> >> I am interested in this for database (all text fields), and also
> > searching
> >> text files on filesystem.
> >>
> >> Now, I'm not trying to recreate Google or anything, and this is
just
> > for
> >> my own research (at this time), but I eventually would like to be
able
> > to
> >> create a smarter site searching engine.
> >>
> >> Can anyone give suggestions? or any links to tutorials (or books)
> >>
> >> I have used regex a little bit before, but not in PHP (only ASP and
> >> JavaScript).
> >>
> >> Adam
> >
> >
> >




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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux