dbTalk Databases Forums  

Full Text Boolean Searchs??? Anyone???

mailing.database.mysql-java mailing.database.mysql-java


Discuss Full Text Boolean Searchs??? Anyone??? in the mailing.database.mysql-java forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael McQuade
 
Posts: n/a

Default Full Text Boolean Searchs??? Anyone??? - 07-22-2004 , 02:08 PM






------=_NextPart_000_000D_01C46FFD.77A83D60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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.......
------=_NextPart_000_000D_01C46FFD.77A83D60--


Reply With Quote
  #2  
Old   
Rikard Froberg
 
Posts: n/a

Default Re: Full Text Boolean Searchs??? Anyone??? - 07-29-2004 , 04:31 AM






Hi, Michael,
Michael McQuade wrote:
Quote:
Hi folks, it there anyone here, that is doing complex queries using the Full TEXT index features and BOOLEAN Searchs????
We are doing boolean queries against full text indexed columns, and this
is how we do it:

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 ('"+
query+
"' IN BOOLEAN MODE) > 0.001";

(the MySQL syntax is:
MATCH (field1, field2) AGAINST ('seach phrase' IN BOOLEAN MODE)
Quote:
[decimal with acurracy, see reference]
Then use it:

String sql = "SELECT s.name, s.price FROM stuff s WHERE " + cond;

ResultSet rs;
Statement stmt = Config.con.createStatement();
stmt.setEscapeProcessing(false);
rs = stmt.executeQuery(query);

etc etc

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.

Quote:
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......

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.

Cheers

Rikard

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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.