RE: Advanced search scripts

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

 




FYI about MySQL Fulltext searching. It's got everything you already want
(in version 4.0.1+):

The boolean full-text search capability supports the following
operators: 

+ A leading plus sign indicates that this word must be present in every
row returned. 

- A leading minus sign indicates that this word must not be present in
any row returned. 

By default (when neither plus nor minus is specified) the word is
optional, but the rows that contain it will be rated higher. This
mimicks the behaviour of MATCH() ... AGAINST() without the IN BOOLEAN
MODE modifier. 

< > These two operators are used to change a word's contribution to the
relevance value that is assigned to a row. The < operator decreases the
contribution and the > operator increases it. See the example below. 

( ) Parentheses are used to group words into subexpressions. 

~ A leading tilde acts as a negation operator, causing the word's
contribution to the row relevance to be negative. It's useful for
marking noise words. A row that contains such a word will be rated lower
than others, but will not be excluded altogether, as it would be with
the - operator. 

* An asterisk is the truncation operator. Unlike the other operators, it
should be appended to the word, not prepended. 

" The phrase, that is enclosed in double quotes ", matches only rows
that contain this phrase literally, as it was typed.

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#Fulltext_Search

---John Holmes...

> -----Original Message-----
> From: John W. Holmes [mailto:holmes072000@charter.net]
> Sent: Wednesday, October 09, 2002 7:02 AM
> To: 'Adam Royle'
> Cc: php-db@lists.php.net
> Subject: RE:  Advanced search scripts
> 
> 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




-- 
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