|
|
@ -98,7 +98,7 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
switch (inField.getAttribute ('id')) |
|
|
switch (inField.getAttribute ('id')) |
|
|
{ |
|
|
{ |
|
|
case 'personSearch1_fname': |
|
|
case 'personSearch1_fname': |
|
|
idx = this.fnameIdx; |
|
|
|
|
|
|
|
|
idx = this.fnameIdx; |
|
|
if (idx != -1) |
|
|
if (idx != -1) |
|
|
{ |
|
|
{ |
|
|
dists = this.fnameDists[idx].split ('::'); |
|
|
dists = this.fnameDists[idx].split ('::'); |
|
|
@ -107,7 +107,7 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case 'personSearch1_sname': |
|
|
case 'personSearch1_sname': |
|
|
idx = this.snameIdx; |
|
|
|
|
|
|
|
|
idx = this.snameIdx; |
|
|
if (idx != -1) |
|
|
if (idx != -1) |
|
|
{ |
|
|
{ |
|
|
dists = this.snameDists[idx].split ('::'); |
|
|
dists = this.snameDists[idx].split ('::'); |
|
|
@ -142,18 +142,28 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
if (dists.length > 0) |
|
|
if (dists.length > 0) |
|
|
// there are caculated distances for surnames
|
|
|
// there are caculated distances for surnames
|
|
|
{ |
|
|
{ |
|
|
var i = 0; |
|
|
|
|
|
var bestMatch = dists[0].split ('::'); // infos for best match
|
|
|
var bestMatch = dists[0].split ('::'); // infos for best match
|
|
|
|
|
|
var len = bestMatch[1]; |
|
|
|
|
|
|
|
|
// reset matches select
|
|
|
// reset matches select
|
|
|
while ((child = bestFit.firstChild) != null) |
|
|
while ((child = bestFit.firstChild) != null) |
|
|
bestFit.removeChild (child); |
|
|
bestFit.removeChild (child); |
|
|
|
|
|
|
|
|
for (match in dists) |
|
|
|
|
|
|
|
|
// len ist ein Array mit entweder snameMaxIdx oder fnameMaxIdx
|
|
|
|
|
|
// als einziges Element. Ich übergebe das als Array um ein call
|
|
|
|
|
|
// bei reference zu simulieren.
|
|
|
|
|
|
if (len < dists.length) |
|
|
|
|
|
while (dists[len].split ('::')[1] < bestMatch[1] && |
|
|
|
|
|
len < dists.lenth) |
|
|
|
|
|
len++; |
|
|
|
|
|
else |
|
|
|
|
|
len = dists.length - 1; |
|
|
|
|
|
|
|
|
|
|
|
for (var i=0; i<len; i++) |
|
|
// walk through all matches
|
|
|
// walk through all matches
|
|
|
{ |
|
|
{ |
|
|
// get infos for match
|
|
|
// get infos for match
|
|
|
var sMatch = dists[match].split ('::'); |
|
|
|
|
|
|
|
|
var sMatch = dists[i].split ('::'); |
|
|
|
|
|
|
|
|
// create list entries
|
|
|
// create list entries
|
|
|
newLi = document.createElement ('li'); |
|
|
newLi = document.createElement ('li'); |
|
|
@ -164,11 +174,6 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
liTxt = document.createTextNode (sMatch[2]); |
|
|
liTxt = document.createTextNode (sMatch[2]); |
|
|
newLi.appendChild (liTxt); |
|
|
newLi.appendChild (liTxt); |
|
|
bestFit.appendChild (newLi); |
|
|
bestFit.appendChild (newLi); |
|
|
i=i+1; |
|
|
|
|
|
|
|
|
|
|
|
if (i >= bestMatch[1] && sMatch[1] > bestMatch[1]) |
|
|
|
|
|
// dont show more than best match distance matches.
|
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
@ -177,10 +182,10 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
// reset matches select
|
|
|
// reset matches select
|
|
|
while ((child = bestFit.firstChild) != null) |
|
|
while ((child = bestFit.firstChild) != null) |
|
|
bestFit.removeChild (child); |
|
|
bestFit.removeChild (child); |
|
|
return new Array (-1, -1, ''); |
|
|
|
|
|
|
|
|
return -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return bestMatch; |
|
|
|
|
|
|
|
|
return len; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.altSurnames = function (_event) |
|
|
this.altSurnames = function (_event) |
|
|
@ -189,12 +194,13 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
var sNameAlt = document.getElementById (this.sNameAlt); |
|
|
var sNameAlt = document.getElementById (this.sNameAlt); |
|
|
|
|
|
|
|
|
this.snameDists = fittingStrings (surname.value, this.surnames, false); |
|
|
this.snameDists = fittingStrings (surname.value, this.surnames, false); |
|
|
|
|
|
|
|
|
if (this.snameDists.length > 0) |
|
|
if (this.snameDists.length > 0) |
|
|
this.snameMaxIdx = this.snameDists[0].split ('::')[1]; |
|
|
|
|
|
|
|
|
this.sNameBest = this.snameDists[0].split ('::'); |
|
|
else |
|
|
else |
|
|
this.snameMaxIdx = -1; |
|
|
|
|
|
|
|
|
this.sNameBest = new Array (-1, -1, ''); |
|
|
|
|
|
|
|
|
this.sNameBest = |
|
|
|
|
|
|
|
|
this.snameMaxIdx = |
|
|
this.genAlternativesList (sNameAlt, this.snameDists, this.snameIdx); |
|
|
this.genAlternativesList (sNameAlt, this.snameDists, this.snameIdx); |
|
|
this.updField (surname, this.sNameBest, this.sNameAlt) |
|
|
this.updField (surname, this.sNameBest, this.sNameAlt) |
|
|
|
|
|
|
|
|
@ -204,9 +210,10 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
this.fnameDists = fittingStrings ( |
|
|
this.fnameDists = fittingStrings ( |
|
|
firstname.value, this.firstnames[this.sNameBest[2]], false); |
|
|
firstname.value, this.firstnames[this.sNameBest[2]], false); |
|
|
if (this.fnameDists.length > 0) |
|
|
if (this.fnameDists.length > 0) |
|
|
this.fnameMaxIdx = this.fnameDists[0].split ('::')[1]; |
|
|
|
|
|
|
|
|
this.fNameBest = this.fnameDists[0].split ('::'); |
|
|
else |
|
|
else |
|
|
this.fnameMaxIdx = -1; |
|
|
|
|
|
|
|
|
this.fNameBest = new Array (-1, -1, ''); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.fnameDists.length > 0) |
|
|
if (this.fnameDists.length > 0) |
|
|
this.fNameBest = this.fnameDists[0].split ('::'); |
|
|
this.fNameBest = this.fnameDists[0].split ('::'); |
|
|
@ -238,15 +245,16 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) |
|
|
var surname = document.getElementById (this.surname); |
|
|
var surname = document.getElementById (this.surname); |
|
|
this.fnameDists = fittingStrings ( |
|
|
this.fnameDists = fittingStrings ( |
|
|
firstname.value, this.firstnames[this.sNameBest[2]], false); |
|
|
firstname.value, this.firstnames[this.sNameBest[2]], false); |
|
|
if (this.fnameDists.length > 0) |
|
|
|
|
|
this.fnameMaxIdx = this.fnameDists[0].split ('::')[1]; |
|
|
|
|
|
else |
|
|
|
|
|
this.fnameMaxIdx = -1; |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
this.fnameDists = new Array (); |
|
|
this.fnameDists = new Array (); |
|
|
|
|
|
|
|
|
this.fNameBest = |
|
|
|
|
|
|
|
|
if (this.fnameDists.length > 0) |
|
|
|
|
|
this.fNameBest = this.fnameDists[0].split ('::'); |
|
|
|
|
|
else |
|
|
|
|
|
this.fNameBest = new Array (-1, -1, ''); |
|
|
|
|
|
|
|
|
|
|
|
this.fnameMaxIdx = |
|
|
this.genAlternativesList (fNameAlt, this.fnameDists, this.fnameIdx); |
|
|
this.genAlternativesList (fNameAlt, this.fnameDists, this.fnameIdx); |
|
|
this.updField (firstname, this.fNameBest, this.fNameAlt) |
|
|
this.updField (firstname, this.fNameBest, this.fNameAlt) |
|
|
|
|
|
|
|
|
|