HTML5 Data Bindings Support Product Page

Answered

Query on a MySQL FULLTEXT index

Asked 25 Jan 2014 13:38:10
1
has this question
25 Jan 2014 13:38:10 Gianmario Colciago posted:
HELLO.
I want to run a query on a MySQL FULLTEXT index like this:

$sql = "EXPLAIN SELECT * 
FROM BOOKS 
WHERE MATCH (title, subtitle, author, edition, publisher, notes)
AGAINST (\ 'alighieri \')"; 

How can I do it with "DATABASE SOURCE QUERY BUILDER"?

Thanks.

Replies

Replied 28 Jan 2014 12:39:37
28 Jan 2014 12:39:37 Teodor Kuduschiev replied:
Hello Gianmario,

Can you please explain what exactly are you trying to achieve?
Replied 28 Jan 2014 14:05:31
28 Jan 2014 14:05:31 Gianmario Colciago replied:
Hello Teodor
On my page I have a search form with only one field and a button to start my search for any text that may be contained in these database fields (title, subtitle, author, edition, publisher, notes ...) FullText indexed.
For example, how can I build this query with "DATABASE SOURCE QUERY BUILDER"?

SELECT * FROM `books` 
WHERE 
MATCH (title, 
     author, 
     subtitle, 
     publishing 
     edition, 
     notes, 
     class, 
    division, 
    section, 
    subsection) 
AGAINST ('William')


Thanks.
Replied 29 Jan 2014 08:14:25
29 Jan 2014 08:14:25 Teodor Kuduschiev replied:
In the Filter tab add the first field that you want to look into, then add the rest and use OR, when adding them, like:
Replied 01 Feb 2014 09:27:01
01 Feb 2014 09:27:01 Gianmario Colciago replied:
Thanks for your reply.
The query that I see in the image works perfectly.
But not this.

SELECT * 
FROM BOOKS 
WHERE 
title LIKE "%william% "
OR subtitle LIKE "%william%"
OR author LIKE "%william%"
AND id_library = 1 
LIMIT 0, 30 


Only this query (with brackets) fetch data correctly.

SELECT * 
FROM BOOKS 
WHERE 
(
      title LIKE "%william%"
     OR subtitle LIKE "%william%"
     OR author LIKE "%william%"
) 
AND id_library = 1 
LIMIT 0, 30 


Please, how can I set it with Data Source Query Builder?
Thanks.
Replied 04 Feb 2014 09:26:11
04 Feb 2014 09:26:11 Georg Koenen replied:
Hi,
in the Query Builder use
for condition "contains" instead of =
and for the Default value use %
This should work for you.

Reply to this topic