1

I am trying to use MySQL Fulltext search feature. Unfortunately documentation does not give any information about getting the search result metadata such as hit offset, total count, etc. How can we achieve this?

Babu James
  • 2,740
  • 4
  • 33
  • 50

1 Answers1

0

Mysql does not provide much metadata about the search results. You can get the so-called relevance score withe the following way:

SELECT id, MATCH (title,body)
    AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) AS score
    FROM articles;

Relevance is computed based on the number of words in the row, the number of unique words in that row, the total number of words in the collection, and the number of documents (rows) that contain a particular word.

You can get a bit more information on the indexes themselves, see this topic on SO

Community
  • 1
  • 1
Shadow
  • 33,525
  • 10
  • 51
  • 64
  • It looks like any rdbms will not have this capability? – Babu James Jan 25 '16 at 04:12
  • I see postgresql provides all these? what do you think? http://www.postgresql.org/docs/9.1/static/textsearch-controls.html – Babu James Jan 25 '16 at 05:01
  • There is nothing like this implemented in mysql in terms of returned result. The closest thing to this is INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE. See the SO topic I linked into my answer for details. – Shadow Jan 25 '16 at 06:39