/** * Gathers results for a soundex search * * TODO * ==== * Does not search on the selected gedcoms, searches on all the gedcoms * Does not work on first names, instead of the code, value array is used in the search * Returns all the names even when Names with hit selected * Does not sort results by first name * Does not work on separate double word surnames * Does not work on duplicate code values of the searched text and does not give the correct code * Cohen should give DM codes 556000, 456000, 460000 and 560000, in 4.1 we search only on 560000?? * * The names' Soundex SQL table contains all the soundex values twice * The places table contains only one value * * The code should be improved - see RFE * */ function SoundexSearch() { if ((!empty($this->lastname) || !empty($this->firstname) || !empty($this->place)) && count($this->sgeds) > 0) { $logstring = "Type: Soundex<br />"; if (!empty($this->lastname)) { $logstring .= "Last name: " . $this->lastname . "<br />"; } if (!empty($this->firstname)) { $logstring .= "First name: " . $this->firstname . "<br />"; } if (!empty($this->place)) { $logstring .= "Place: " . $this->place . "<br />"; } if (!empty($this->year)) { $logstring .= "Year: " . $this->year . "<br />"; } AddToSearchlog($logstring, $this->sgeds); // Get a list of gedcom IDs to search // TODO: don't we already have this somewhere? $ged_ids = array(); foreach ($this->sgeds as $gedcom) { $ged_ids[] = get_id_from_gedcom($gedcom); } if ($ged_ids) { $this->myindilist = search_indis_soundex($this->soundex, $this->lastname, $this->firstname, $this->place, $ged_ids); } else { $this->myindilist = array(); } } // Now we have the final list of indi's to be printed. // We may add the assos at this point. if ($this->showasso == "on") { foreach ($this->myindilist as $indi) { foreach (fetch_linked_indi($indi->getXref(), 'ASSO', $indi->getGedId()) as $asso) { $this->myindilist[] = $asso; } foreach (fetch_linked_fam($indi->getXref(), 'ASSO', $indi->getGedId()) as $asso) { $this->myfamlist[] = $asso; } } } //-- if only 1 item is returned, automatically forward to that item if (count($this->myindilist) == 1 && $this->action != "replace") { $indi = $this->myindilist[0]; header("Location: " . encode_url($indi->getLinkUrl(), false)); exit; } usort($this->myindilist, array('GedcomRecord', 'Compare')); usort($this->myfamlist, array('GedcomRecord', 'Compare')); }
/** * Gathers results for a soundex search * * TODO * ==== * Does not search on the selected gedcoms, searches on all the gedcoms * Does not work on first names, instead of the code, value array is used in the search * Returns all the names even when Names with hit selected * Does not sort results by first name * Does not work on separate double word surnames * Does not work on duplicate code values of the searched text and does not give the correct code * Cohen should give DM codes 556000, 456000, 460000 and 560000, in 4.1 we search only on 560000?? * * The names' Soundex SQL table contains all the soundex values twice * The places table contains only one value * * The code should be improved - see RFE * */ function SoundexSearch() { if ((!empty($this->lastname) || !empty($this->firstname) || !empty($this->place)) && count($this->sgeds) > 0) { $logstring = "Type: Soundex\n"; if (!empty($this->lastname)) { $logstring .= "Last name: " . $this->lastname . "\n"; } if (!empty($this->firstname)) { $logstring .= "First name: " . $this->firstname . "\n"; } if (!empty($this->place)) { $logstring .= "Place: " . $this->place . "\n"; } if (!empty($this->year)) { $logstring .= "Year: " . $this->year . "\n"; } AddToSearchlog($logstring, $this->sgeds); if ($this->sgeds) { $this->myindilist = search_indis_soundex($this->soundex, $this->lastname, $this->firstname, $this->place, array_keys($this->sgeds)); } else { $this->myindilist = array(); } } // Now we have the final list of individuals to be printed. // We may add the assos at this point. if ($this->showasso == 'on') { foreach ($this->myindilist as $indi) { foreach ($indi->linkedIndividuals('ASSO') as $asso) { $this->myindilist[] = $asso; } foreach ($indi->linkedIndividuals('_ASSO') as $asso) { $this->myindilist[] = $asso; } foreach ($indi->linkedFamilies('ASSO') as $asso) { $this->myfamlist[] = $asso; } foreach ($indi->linkedFamilies('_ASSO') as $asso) { $this->myfamlist[] = $asso; } } } //-- if only 1 item is returned, automatically forward to that item if (count($this->myindilist) == 1 && $this->action != "replace") { $indi = $this->myindilist[0]; header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . $indi->getRawUrl()); exit; } usort($this->myindilist, array('WT_GedcomRecord', 'compare')); usort($this->myfamlist, array('WT_GedcomRecord', 'compare')); }