webCOMAND

MATCHES()

Matches field against a string of space-separated keywords.  The field must be full-text indexed field like .Keywords().  This is useful for performing efficient keyword searches, which are currently implemented using MySQL's Full-Text Search Functions.

Future versions will add an option similar to "IN BOOLEAN MODE" in MySQL, to allow BOOLEAN Mode match strings.

Prototype

float MATCHES(string $field, string $keywords)

Parameters

  • field - The field identifier of the content type field to search.  It must be a full-text search field, like .Keywords().
  • keywords - A space-separated list of keywords to search.

Return

A score where a higher number is a better match.  No match will return zero.  MATCHES() can be used in a SELECT, WHERE and/or ORDER BY clauses.

It produces the same results as MySQL would for:

MATCH(field) AGAINST (keywords)

Example

SELECT OID, MATCHES(.Keywords(),'search terms') AS Score
FROM User WHERE MATCHES(.Keywords(),'search terms')
ORDER BY MATCHES(.Keywords(),'search terms') DESC

Related

INSTR(), LOCATE()