Created
September 25, 2014 23:41
-
-
Save hmkz/d842305ac02dd3f5e9a7 to your computer and use it in GitHub Desktop.
転置インデックス実装例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//転置インデックスを作成 | |
$comp_list_reverse = array(); | |
foreach ($comp_list as $key => $value) { | |
$hashed = md5($value); | |
$comp_list_reverse[$hashed] = $key; | |
} | |
$keyword_name_list_reverse = array(); | |
foreach ($keyword_name_list as $key => $value) { | |
$hashed = md5($value); | |
$keyword_name_list_reverse[$hashed] = $key; | |
} | |
foreach($list AS $data){ | |
$hashed = md5($data['vc_kw']); | |
$comp_list_results = false; | |
$keyword_name_list_results = false; | |
if (isset($comp_list_reverse[$hashed])) { | |
$comp_list_key = $comp_list_reverse[$hashed]; | |
$comp_list_results = isset($comp_list[$comp_list_key]); | |
} | |
if ($keyword_name_list_reverse[$hashed]) { | |
$keyword_name_list_key = $keyword_name_list_reverse[$hashed]; | |
$keyword_name_list_results = isset($keyword_name_list[$keyword_name_list_key]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment