Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Regex and multiple word search
Message
 
 
To
09/07/2009 10:39:04
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01411109
Message ID:
01411157
Views:
21
>>I don't see that much of a difference.
>>
>>Create cursor WordsToSearch(Word C(50))
>>
>>insert into WordsToSearch values ('Word1')
>>insert into WordsToSearch values ('Another Word')
>>insert into WordsToSearch values ('Yet another')
>>lnI = 0
>>scan
>>  lnI = lnI + 1
>>  
>>   lcWord = ' ' + WordsToSearch.Word + ' '
>>   if lnI = 1
>>    select * from myTable where ' ' + myFieldToSearch + '  '  LIKE '%' + lcWord + '%' into cursor OurTempResult nofilter
>>   else
>>        select * from OurTempResult where ' ' + myFieldToSearch + '  '  LIKE '%' + lcWord + '%' into cursor OurTempResult nofilter
>>    endif
>>   ** Or alternatively
>>
>>       select * from myTable where lcWord $ '  ' + myFieldToSearch + '  '
>>endscan
>>
>>
>>vs. one Select solution. (this is from the top of my head - your idea of searching for each word in a loop)
>
>If you take a closer look at my solution, you will see that it's very flexible since you can have any number of words in the search string.

I think we set up the initial requirements slightly differently - I pass a cursor of words to search, you pass a string with words, but at the end, I still don't see a difference between using a FOR loop or a scan?

Also, wouldn't your current solution (as you presented it) find words inside the words?

E.g.

Search string 'My big bad dog ate my whole dinner'

Table

'My biggest hotdog is wholesome and grateful"

Would your search find this record?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform