FineTune searching
FlexibleLearning at aol.com
FlexibleLearning at aol.com
Wed May 4 16:57:43 EDT 2005
Hi troops,
As part of a genealogy project, I needed a search that could be more or less
specific (and so give more or fewer matches) depending on the User's
selection of 'Narrow, Wide, Wider'.
How have others resolved this?
function booleanMatch fineTuneLevel,tStr,tSrcString
--| Param fineTuneLevel: 1 = exact phrase, 2 = all words [AND], 3 = any
string [OR]
if fineTuneLevel =1 then
# Whole match...
if num of words of tStr=1 then
put (tStr is among the words of tSrcString OR\
tStr is among the tokens of tSrcString) into isMATCH
else put tStr is in tSrcString into isMATCH
else
# Partial match...
repeat for each word w in tStr
if fineTuneLevel =2 then
-- by Word
put (w is among the words of tSrcString OR\
w is among the tokens of tSrcString) &CR after isMATCH
else
-- by String
put (w is in tSrcString) &CR after isMATCH # Each string
end if
end repeat
end if
if TRUE is not in isMATCH then return FALSE
if (fineTuneLevel is in "1,2") AND (FALSE is in isMATCH) then return FALSE
else return TRUE
end booleanMatch
/H
Hugh Senior
The Flexible Learning Company
Web: _www.FlexibleLearning.com_ (http://www.flexiblelearning.com/)
E: _h at flexiblelearning.com_ (mailto:h at flexiblelearning.com)
T/F: +44(0)1483.27 87 27
More information about the use-livecode
mailing list