Full Text Boolean Searchs??? Anyone??? - 07-22-2004 , 02:08 PM
Hi folks, it there anyone here, that is doing complex queries using the =
Full TEXT index features and BOOLEAN Searchs????
Do you know if JDBC v 3.1.3-beta and MYSQL 4.1.3b-beta support this =
feature, and does it work?????? Im desperate for answers, please =
email me..... Could you also send some sample code, if thats =
possible.... thank you so much.......
Re: Full Text Boolean Searchs??? Anyone??? - 07-29-2004 , 04:31 AM
Michael McQuade wrote:
Having created an index on table song, fields "name" and "description",
the customers enter a search string, "query". If this is to be
boolean, you'll have to use "+" in front of words that logically
must be within the results (as with google searches) and a "-"
before words that shan't be within the result.
The code, then:
// First build up the query string for the full text condition:
String cond="MATCH (s.name, s.description) AGAINST ('"+
"' IN BOOLEAN MODE) > 0.001";
(the MySQL syntax is:
MATCH (field1, field2) AGAINST ('seach phrase' IN BOOLEAN MODE)
String sql = "SELECT s.name, s.price FROM stuff s WHERE " + cond;
Statement stmt = Config.con.createStatement();
rs = stmt.executeQuery(query);
Naturally irl, you'll strip the query string from unwanted characters
first, and implement some kind of "next 15 matches" scheme.
You will also need to inform the users of the search thing how boolean
searches works. Example: all cars that have 4wd but are not Hondas:
"+car +4wd -honda"
As to your question of "complex" queries, you can have as complex
queries you'd like together with this feature, since it is a boolean
expression with the "greater than character". Just AND it to your
"complex" WHERE clause.
Could you also send some sample code, if thats possible.... thank you
This has not so much to do with JDBC as with the engine itself imho.
Hope you can have any use of my example above.
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/java?unsub=my...ie.nctu.edu.tw