PDA

View Full Version : OR functionality


vonbrocklin
09-06-2003, 08:05 PM
I just discovered phpDig and it seems great but I have not really looked at the internal code yet. How hard would it be to add "OR" functionality to phpDig? I'm assuming it would be quite difficult seeing that it is not already part of the functionality.

Charter
09-07-2003, 08:39 AM
As of MySQL 4.0.1, FULLTEXT boolean searches can be done using the IN BOOLEAN MODE modifier. At http://www.mysql.com/doc/en/Fulltext_Search.html there is a list of boolean operators available with MySQL 4.0.1+.

For those using MySQL 3.XX.XX, David Altherr wrote some boolean functions for use with MySQL 3.23.23+. Attached is a ZIP of these functions, which David has released for free under the MIT open source license.

renehaentjens
11-19-2003, 02:00 PM
The current version of PhpDig doesn't use the MySQL FULLTEXT capabilities, am I right?

Why not?

Charter
11-19-2003, 10:01 PM
Hi. Yes, you are correct. PhpDig stores keywords and uses those keywords to pull search results from relevant text files. More information about using a FULLTEXT index can be found here (http://www.databasejournal.com/features/mysql/article.php/1578331).

renehaentjens
11-24-2003, 03:41 AM
The article you refer to is interesting, thank you.

It concludes with the following words: "For many applications, boolean searches are one of MySQL 4's most useful features. With careful use, you can save yourself substantial of development time, and add many useful enhancements." So, my question remains open: why doesn't PhpDig make use of this capability?

Charter
11-24-2003, 07:45 AM
Hi. The MATCH AGAINST capabilites were introduced in the MySQL 3.23.23 version, do not allow for partial word matching, and exclude results where keyword can be found in over half of the rows. The IN BOOLEAN MODE capabilites were introduced in MySQL 4.0.1 and are not available in MySQL 3.23.x versions. MySQL 4.0.x reached production level in the spring of 2003, and there are many users who still utilize MySQL 3.23.x versions. PhpDig was written to store keywords and use those keywords to pull results from text files. This circumvents certain limits with MATCH AGAINST queries and avoids using LIKE queries on pages of text. When MySQL 4.x.x becomes the standard package for all MySQL users, PhpDig would need major changes in order to make use of IN BOOLEAN MODE capabilities.

renehaentjens
11-27-2003, 07:11 AM
Clear and to the point. Thank you.

From the MySQL documentation that I have seen, it is not clear to me whether the following limitations also apply IN BOOLEAN MODE:
- words of 3 letters are not taken into account;
- words are composed of letters, digits, hyphens and underscores and this cannot be customized easily.

PhpDig considers words as composed of letters, digits, points, hyphens, underscores, ampersands and slashes isn't it? And as it is open source, I guess it must not be hard to change that?

Has anyone tried to compare the indexing and/or searching speed of PhpDig's keyword method against using MySQL 4's FULLTEXT + IN BOOLEAN MODE?

obottek
11-28-2003, 04:57 AM
I would like to say something with respect to the information that Carter mentioned, that the way that phpdig stores keywords in the datbase and so on limits the search functionality. That is not really true.

Actually we had the same problem (need of OR or even full text search queries) and came to the point to skip the (sorry for that) anyway unflexible search front-end of phpdig and to query the database directly. This works great and with the content-text files we realized a full text search.

Charter
11-28-2003, 05:12 AM
Hi. Hmm, I don't think I said that the method PhpDig uses to store keywords limits search functionality. ;)

obottek
11-28-2003, 05:33 AM
Well first of all sorry for misspelling your name, Charter. Secondly sorry for calling your name, but it was meaned to be instead of everybody who started discussing about database versions, when someone asked for an OR-connected search via the engine.

Charter
11-28-2003, 05:36 AM
Hi. There's no reason to be sorry. ;)

Yes, something can be programmed to get OR functionality.

bloodjelly
12-20-2003, 06:49 PM
Hi there -

I'm also very interested in getting PhpDig to support the "OR" function. Would someone be willing to post the code changes necessary in search_function.php that would allow this? I'm willing to write my own code but I'd like somewhere to start if someone's already done this, rather than re-inventing the wheel so to speak. Thanks!

bloodjelly
01-02-2004, 04:14 PM
I'm a newbie so I guess this function has already been implemented? I see in the 1.6.5 demo that OR works, but on my site it doesn't. Could this be due to an older version of MySQL? If so it'd be nice to know so I can update. Thanks for the help.

Charter
01-02-2004, 09:08 PM
Hi. The online demo uses "and operator - exact words - or operator" searching options, and this is currently in beta. The PhpDig 1.6.5 package uses "words begin - exact words - any words part" searching options. Visit here (http://www.phpdig.net/showthread.php?threadid=337) to try the "and operator - exact words - or operator" searching options with PhpDig 1.6.5.

bloodjelly
01-03-2004, 10:01 AM
Thanks a lot, it works great so far. Good luck with the next version.