Best way to design soundex based search -


i have table of forum posts, , want improve basic search functionality lot of users on world not native english speakers , have trouble finding results when spell incorrectly. current forum search exact.

which of these designs perform best? assume database has 500,000 records , search used frequently. ideally search every record.

design one

along side each forum post, store soundex_post, contains soundex data. when search run, soundexes search terms, , operation on soundex fields.

design two

i normalise it. every soundex code stored in new table, tblsoundexcodes. there table tblforumpostsoundexcodes:

id | post_id | soundexcode_id | count

then when soundex searched for, pull out post_ids soundexcode_id = n

am correct method 2 considerably faster, lot harder maintain (ie, when people edit posts).

design 2 better.

design 2 won't faster. data storage more compact, , have update or insert row tblforumpostsoundexcodes, insert row tblsoundexcodes, when writes or updates post.

you'll have verify soundex transaction processing takes place every change post (create, update, delete).


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -