FineTune searching

FlexibleLearning at aol.com FlexibleLearning at aol.com
Thu May 5 03:58:10 EDT 2005


Neat, Mark...Filter is not among the words of my_frontThoughts!
 
/H

-----
Here's my take on what you presented:

function booleanMatch  fineTuneLevel, pStr, pSrcString
local blnReturn

-- turn multiple lines into a stream
replace cr with space in  pSrcString
put false into blnReturn

--| Param  fineTuneLevel:
-- 1 = exact phrase
-- 2 = all  words  [AND]
-- 3 = any string [OR]
switch fineTuneLevel
case 1 -- EXACT
filter pSrcString with "*" & pStr &  "*"
put (pSrcString is not empty) into blnReturn
break
case 2 -- ALL
repeat for each word w in  pStr
filter pSrcString with "*" & w &  "*"
end repeat
put (pSrcString is not empty)  into blnReturn
break
default -- ANY
repeat for each word w in pStr
if (w is in pSrcString)  then
put true into blnReturn
-- no need to go on
exit  repeat
end if
end repeat
end  switch

return blnReturn
end booleanMatch

-----


More information about the use-livecode mailing list