i using php/mysql major project in college. search engine made.
my database contain results sentence 'who first president of america'.
my question is, when user enter same query without white space (e.g.: 'whoisthefirstpresidentofamerica') search engine fails retrieve results database.
is there anyway find words string doesn't contain spaces?
you can comparison removing spaces both strings:
select * t replace(t.col, ' ', '') = replace(@val, ' ', '') however, suspect want use full text search capabilities of mysql. if dealing sentences, far better way go. can start learning them here.
edit:
if purpose investigate different ranking algorithms, need learn text search , analysis. place start mysql documentation on full text search. however, not let customize ranking methods easily.
in particular, should storing text in "document-term" format. is, have sentence split multiple rows, 1 each term in sentence, along word-position column. give flexibility need investigate own ranking algorithms.
Comments
Post a Comment