Jump to content

MATCH AGAINST problem...


kodlcan

Recommended Posts

I have followin':

CREATE TABLE `PKZ_ciselnik` (
  `ciselnik_PKZ` int(10) unsigned NOT NULL default '0',-- id
  `ciselnik_nazevzbozi` varchar(255) NOT NULL default '',-- product name
  `ciselnik_nazevpodskupiny` varchar(255) NOT NULL default '',-- subclass name
  `ciselnik_nazevvyrobce` varchar(255) NOT NULL default ''-- manufacturer
) ENGINE=MyISAM DEFAULT CHARSET=cp1250;

CREATE TABLE `lekarny` (-- reseller
  `lekarna_id` tinyint(3) unsigned NOT NULL default '0',--id
  `lekarna_jmeno` varchar(255) NOT NULL default ''--name
) ENGINE=MyISAM DEFAULT CHARSET=cp1250;

CREATE TABLE `zbozi_vse` (
  `zbozi_PKD` int(10) unsigned NOT NULL default '0',--id
  `zbozi_mnozstvi` int(11) NOT NULL default '0',--amount
  `zbozi_cenasdph` float unsigned NOT NULL default '0',--price
  `zbozi_lekarna` tinyint(3) unsigned NOT NULL default '0',--drugstore number
  `zbozi_SID` int(10) unsigned NOT NULL default '0'--drugstore internal number
) ENGINE=MyISAM DEFAULT CHARSET=cp1250;

The problem is that I need custom this working schema to work with Score parameter to sort it by relevancy:
I have this: and it works...

SELECT ciselnik_PKZ, ciselnik_nazevzbozi, ciselnik_nazevvyrobce, lekarna_jmeno, zbozi_mnozstvi, zbozi_cenasdph FROM PKZ_ciselnik, zbozi_vse, lekarny WHERE (PKZ_ciselnik.ciselnik_PKZ = zbozi_vse.zbozi_PKD AND zbozi_vse.zbozi_lekarna = lekarny.lekarna_id) AND MATCH(ciselnik_nazevzbozi, ciselnik_nazevvyrobce) AGAINST('+"$query1 +$query2' IN BOOLEAN MODE);

but how to custom it like this: ??

SELECT *, MATCH(title, body) AGAINST('$keyword') AS score
FROM articles
WHERE MATCH(title, body) AGAINST('$keyword')
ORDER BY score DESC

The problem is how to acomplish to implement the part where two tables are joined with WHERE with MATCH...AGAINST part. When I simply rewrite sample with my data like this "WHERE (PKZ_ciselnik.ciselnik_PKZ = zbozi_vse.zbozi_PKD AND zbozi_vse.zbozi_lekarna = lekarny.lekarna_id) AND MATCH (ciselnik_nazevzbozi, ciselnik_nazevvyrobce) AGAINST ('paralen')AS Score ORDER BY Score;
mySQL reports error in the "...AS Score part".


Could anyone help me with??

ThnX a lot.

Kodl
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.