RE: [PHP-DB] Advanced search scripts

2002-10-09 Thread John W. Holmes

What database are you using?

---John Holmes...

 -Original Message-
 From: Adam Royle [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 2:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] 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




Re: [PHP-DB] Advanced search scripts

2002-10-09 Thread Adam Royle

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:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 2:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] 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




RE: [PHP-DB] Advanced search scripts

2002-10-09 Thread John W. Holmes

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:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 6:54 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] 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:[EMAIL PROTECTED]]
  Sent: Wednesday, October 09, 2002 2:09 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] 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




RE: [PHP-DB] Advanced search scripts

2002-10-09 Thread John W. Holmes


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:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 7:02 AM
 To: 'Adam Royle'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]]
  Sent: Wednesday, October 09, 2002 6:54 AM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] 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:[EMAIL PROTECTED]]
   Sent: Wednesday, October 09, 2002 2:09 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP-DB] 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




RE: [PHP-DB] Advanced search scripts

2002-10-09 Thread Hutchins, Richard

John (and list),

Do you know if MySQL 4.0.x and PHP 4.2.x are fully compatible? I'm
interested in the topics you have been discussing in this thread and don't
really want to pursue upgrading MySQL if the support is only experimental
at this stage (i.e. Apache 2.0).

Thanks,
Rich

 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 7:08 AM
 To: 'Adam Royle'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Advanced search scripts
 
 
 
 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_Refe
 rence.html
 #Fulltext_Search
 
 ---John Holmes...
 
  -Original Message-
  From: John W. Holmes [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, October 09, 2002 7:02 AM
  To: 'Adam Royle'
  Cc: [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]]
   Sent: Wednesday, October 09, 2002 6:54 AM
   To: [EMAIL PROTECTED]
   Cc: [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] 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:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 2:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] 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

RE: [PHP-DB] Advanced search scripts

2002-10-09 Thread John W. Holmes

Well, MySQL 4 is still marked as a development version, so it's not
completely finished yet. PHP will interface with it no problem, though,
all it really does is connect and send queries. Nothing has changed
there. PHP 4.3 will provide support for connecting to the database with
SSL. That's the only thing so far that's not supported, as far as I
know.

---John Holmes...

 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 8:35 AM
 To: '[EMAIL PROTECTED]'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Advanced search scripts
 
 John (and list),
 
 Do you know if MySQL 4.0.x and PHP 4.2.x are fully compatible? I'm
 interested in the topics you have been discussing in this thread and
don't
 really want to pursue upgrading MySQL if the support is only
 experimental
 at this stage (i.e. Apache 2.0).
 
 Thanks,
 Rich
 
  -Original Message-
  From: John W. Holmes [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, October 09, 2002 7:08 AM
  To: 'Adam Royle'
  Cc: [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] Advanced search scripts
 
 
 
  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_Refe
  rence.html
  #Fulltext_Search
 
  ---John Holmes...
 
   -Original Message-
   From: John W. Holmes [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, October 09, 2002 7:02 AM
   To: 'Adam Royle'
   Cc: [EMAIL PROTECTED]
   Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 6:54 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] 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:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 2:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] 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

RE: [PHP-DB] Advanced search scripts

2002-10-09 Thread Jeffrey_N_Dyke


For what its worth.  I wrote to the MySql folks asking about a production
release date and the reply was that they consider the latest in Beta, and
according to them, that is 'production ready' as it has gone through adn
passed all their rigorous testing.  Have I upgraded yet? No.  But, I've
seen this mentioned a couple times out here and thought it was worth
sharing.

Jeff



   
 
  John W. Holmes 
 
  holmes072000@chaTo:   'Hutchins, Richard' 
[EMAIL PROTECTED] 
  rter.netcc:   [EMAIL PROTECTED]
 
   Subject:  RE: [PHP-DB] Advanced search 
scripts   
  10/09/2002 08:46 
 
  AM   
 
  Please respond to
 
  holmes072000 
 
   
 
   
 




Well, MySQL 4 is still marked as a development version, so it's not
completely finished yet. PHP will interface with it no problem, though,
all it really does is connect and send queries. Nothing has changed
there. PHP 4.3 will provide support for connecting to the database with
SSL. That's the only thing so far that's not supported, as far as I
know.

---John Holmes...

 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 8:35 AM
 To: '[EMAIL PROTECTED]'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Advanced search scripts

 John (and list),

 Do you know if MySQL 4.0.x and PHP 4.2.x are fully compatible? I'm
 interested in the topics you have been discussing in this thread and
don't
 really want to pursue upgrading MySQL if the support is only
 experimental
 at this stage (i.e. Apache 2.0).

 Thanks,
 Rich

  -Original Message-
  From: John W. Holmes [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, October 09, 2002 7:08 AM
  To: 'Adam Royle'
  Cc: [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] Advanced search scripts
 
 
 
  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_Refe
  rence.html
  #Fulltext_Search
 
  ---John Holmes...
 
   -Original Message-
   From: John W. Holmes [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, October 09, 2002 7:02 AM
   To: 'Adam Royle'
   Cc: [EMAIL PROTECTED]
   Subject: RE: [PHP-DB] 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