Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Google-like queries in FoxPro apps
Message
From
06/05/2002 16:49:35
Rick Graves
Advanced Approach Ltd.
Hong Kong, Hong Kong
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00624182
Message ID:
00653264
Views:
28
Steve,

You have a point about searching for exact phrases.

I did some investigation (explained below), and here is my bottom line: your cData field should be as long as the biggest "Phrase Search" (that is, exact phrase search) that you want to handle. Google's limit is about 55 words (as explained below). So if your cData field was 55 or 60 characters long, no one would complain. I think even shorter might be OK.

If you go to Google and type "telephone system" (without quotes) in the field, you get sites with "telephone" and "system" anywhere. Most sites would not have the two words back separated by only a space and in order. If you want the exact phrase, you have to put the quotation marks around "telephone system" in the search field.

I wondered what is the longest exact phrase that Google will accept. So I went to Google and clicked on Advanced Search, which is to the right of the search text field.

There are several fields, including an exact phrase field with this help text:

Phrase Searches

Search for complete phrases by enclosing them in quotation marks. Words enclosed in double quotes ("like this") will appear together in all results exactly as you have entered them. Phrase searches are especially useful when searching for famous sayings or proper names.

I did not find the limit on phrase length, so out of desperation (and lack of creativity) I used copy and paste to search for this:

"Search for complete phrases by enclosing them in quotation marks. Words enclosed in double quotes"

I had to stop at the double quotes, obviously.

I got no complaint from Google and lots of results with this exact phrase. So I tried something longer,

"will appear together in all results exactly as you have entered them. Phrase searches are especially useful when searching for famous sayings or proper names"

Again, I got no complaint from Google and lots of results with this exact phrase. It seems zillions of sites use this exact description for exact phrase searches. Many use the same example as Google, ("like this"), but others customize it with something specific to their area of interest.

But I noticed that only these words were in bold in the results:

will appear together in all results exactly as you have

Then I noticed in faint text at the top of the screen:

"entered" (and any subsequent words) was ignored because we limit queries to 10 words

I do not know about their indexing system, but in FoxPro a maximum number of characters would be the way to go. In this case, the 10 words ("will appear together in all results exactly as you have") come to 55 characters [according to LEN()].

This brings up another point: You can get "industry standard" syntax for advanced Google searches from the Google Advanced Search page. That is YOUR specification for your Google-like search utility! And since everyone else is using the same exact help text to describe advanced searches, I think it would be safe for you to do the same. You could copy and paste. So you can use all the Advanced Searches help text you find in Google as your specification.

Back to your example.

If you type "telephone system" into the search text field without the quotes, the default behavior is results with "telephone" and "system" anywhere. You only need to search for the exact phrase if your end user puts it in quotes.

As a result, when generating your cData fields, when you take the first word off the front, I do not think you need to tack that word onto the end. Rather, if space allows, take the next word you find from that text source. If there is nothing more at the end of the text source, then you can just leave the rest blank.

For normal searches (not exact phrase), I think you need to do a query for each word separately and then merge (join? -- terminology issue) the results.

I hope this is helpful!

Rick
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform