php - Possible to order an SQL query that matches with a REGEX by the number of matches found? -


I am using a SQL query such as WHERE name REGEXP '[[: & lt ;:] ] Some [[:: & gt ;:]] '.

Now all this works very well, but orders are not ordered based on the number of matches of my results, which is what I see.

Thanks

Full Query

  Select Item.  

`` `` `` `` `` `` `` `` `` ] '' Or (`item` .`name` regxp '[[:: & lt ;:]] world [[: & gt;:]]')

The user is prepared on the basis of input, in each place it divides into a different part that is searched. I would like to order results based on the number of matches of all parts, thus the most relevant results are on top

< P> I got an UDF sometime back to do this. I'm really sorry I can not quote though the source.
  DELIMITER // CREATE DEFINER = `Route` @ 'localhost' function 'substrate number' (SVARAR (255), SS VAARAR (255)) Return tint (3) unsigned SQL data The redirection starts is calculated from the tinnitus (3), DECLARE offset TINYINT (3) Uncredited; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET s = NULL; Set count = 0; Set offset = 1; Repeat if ISNULL (s) and offset & gt; 0 then offset = location (ss, s, offset); If Offset & gt; 0 set count = count + 1; Set offset = offset + 1; end if; end if; ISNULL (s) or offset = 0 until repeat the end; Return calculation; END DELIMITER;   

There was also a solution to the Nifty.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -