‘CREATE INDEX’ for mysql Table if field is BLOB

By admin, written on February 28, 2010

howto

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • Which SQL implementations are mostly used in your projects?

    • MySQL (44%, 4 Votes)
    • We don't use SQL (44%, 4 Votes)
    • MS SQL Server (22%, 2 Votes)
    • Oracle (11%, 1 Votes)
    • Standard (0%, 0 Votes)
    • PostgreSQL (0%, 0 Votes)
    • DB2 (0%, 0 Votes)
    • mSQL (0%, 0 Votes)
    • Informix (0%, 0 Votes)
    • Something else (0%, 0 Votes)

    Total Voters: 9

    Vote

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:

Mysql allows the fulltext search. To do that, there must be an index

For example, you have two fields which you want to be searched:
my_correct_column of TEXT type
my_column of BLOB type

You try:

ALTER TABLE my_table ADD FULLTEXT `related_index` ( `my_correct_column` , `my_column` )

and get something like this:

ERROR 1170 (42000): BLOB/TEXT column ‘my_column’ used in key specification without a key length
or maybe
ERROR 1283 (HY000): Column ‘my_column’ cannot be part of FULLTEXT index

[!!] Problem is, that many text fields are stored in mysql not in TEXT format, but as BLOB (my_column).

MYSQL doesn’t allow indexing BLOB’s. The reason might be simple, that binary format should not be searched.

To add the index, format of field should be changed:

ALTER TABLE my_table MODIFY my_column TEXT;

[i] Remark: It also fixes the issue with many Wordpress plugins, particularly of “what is related” type, complaining that they fail to create an index.
I had this problem with “Yet Another Related Posts Plugin (YARPP)”

 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 2 votes)
1 votes 'YES'  1 votes 'NO'

LEARN MORE (amazon bookstore)

TAGS

RELATED
Pages
Posts
    nope :(

SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

INCOMING SEARCH TERMS


Leave a Reply