This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
admin:indexing:powersearch:sql [2011/01/24 05:14] els |
admin:indexing:powersearch:sql [2012/10/26 14:57] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~NOTOC~~ | ||
| {{page>:top_add&nofooter&noeditbtn}} | {{page>:top_add&nofooter&noeditbtn}} | ||
| Line 10: | Line 11: | ||
| **[[admin:indexing:powersearch:sql|SQL]]** | | **[[admin:indexing:powersearch:sql|SQL]]** | | ||
| [[admin:indexing:powersearch:optimization|Optimization]] | | [[admin:indexing:powersearch:optimization|Optimization]] | | ||
| + | [[admin:indexing:powersearch:custom|Customization]] | | ||
| [[admin:indexing:powersearch:tips|Tips]] | [[admin:indexing:powersearch:tips|Tips]] | ||
| Line 40: | Line 42: | ||
| The real advantage of the $CONTAINS function lies in the options that can be added. The $CONTAINS function is discussed in depth in the [[dev:sql:functions:contains:home|documentation]] on the function. Meanwhile, the following examples show how the options were used to provide each of the capabilities shown on the previous page. | The real advantage of the $CONTAINS function lies in the options that can be added. The $CONTAINS function is discussed in depth in the [[dev:sql:functions:contains:home|documentation]] on the function. Meanwhile, the following examples show how the options were used to provide each of the capabilities shown on the previous page. | ||
| + | \\ | ||
| + | ---- | ||
| === First Name === | === First Name === | ||
| - | When searching a database containing first names, you never know whether the formal given name is stored, or one of common variations. PowerSearch will automatically search for common synonyms for first names. | + | PowerSearch uses a given names synonym list to search for both the formal given name and the most common variations. For example: |
| - | + | ||
| - | Here are some examples: | + | |
| + | |< 85% 30% 70% >| | ||
| ^ Given Name ^ Synonyms ^ | ^ Given Name ^ Synonyms ^ | ||
| |William |Bill, Billy, Will, Williams, Willie, Willis, Wilson | | |William |Bill, Billy, Will, Williams, Willie, Willis, Wilson | | ||
| Line 52: | Line 54: | ||
| |Elizabeth |Beth, Betty, Eliza, Elsa, Lisa, Liz, Liza | | |Elizabeth |Beth, Betty, Eliza, Elsa, Lisa, Liz, Liza | | ||
| |Ann |Ana, Anita, Anna, Anne, Annette, Annie, Annmarie | | |Ann |Ana, Anita, Anna, Anne, Annette, Annie, Annmarie | | ||
| - | |------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | ||
| The SQL syntax for given name synonyms searches is shown below. | The SQL syntax for given name synonyms searches is shown below. | ||
| Line 62: | Line 63: | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Last Name === | === Last Name === | ||
| - | Many last names sound similar, but are spelled differently. For this reason, phonetic algorithms such as Soundex or Metaphone are commonly used to find last names that sound similar to each other. PowerSearch will automatically search for phonetic equivalents for last names. | + | PowerSearch uses phonetic algorithms to search for last names that sound similar, but are spelled differently. |
| Here are some examples: | Here are some examples: | ||
| + | |< 85% 30% 70% >| | ||
| ^ Last Name ^ Phonetic Equivalents ^ | ^ Last Name ^ Phonetic Equivalents ^ | ||
| |Smith |Schmit, Schmidt, Schmitt, Smidt, Smit, Smith, Smithey, Smyth, Smythe | | |Smith |Schmit, Schmidt, Schmitt, Smidt, Smit, Smith, Smithey, Smyth, Smythe | | ||
| Line 73: | Line 77: | ||
| |Nelson |Nelsen, Nielsen, Nielson, Neilsen, Neilson, Nilsen, Nilson, Nilsson | | |Nelson |Nelsen, Nielsen, Nielson, Neilsen, Neilson, Nilsen, Nilson, Nilsson | | ||
| |Williams |Willaims, Wiliams, Willimas, Wilmes, Willams, Willems | | |Williams |Willaims, Wiliams, Willimas, Wilmes, Willams, Willems | | ||
| - | |------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | ||
| - | The SQL syntax for phonetic last name searches is shown below. | + | The SQL syntax for phonetic last name searches is shown below. Note that phonetic searches require an index that uses the [[admin:indexing:types:options#phonetic|PHONETIC]] option. |
| <code sql> | <code sql> | ||
| Line 83: | Line 86: | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Address === | === Address === | ||
| - | Many addresses use both common and uncommon abbreviations. Street numbers can be easily transposed. Street names can be easily misspelled. PowerSearch will automatically look for abbreviations, misspellings and transpositions. | + | PowerSearch uses a postal abbreviations synonym list, combined with misspelling and transposition algorithms, to search street addresses. |
| Here are some examples: | Here are some examples: | ||
| + | |< 85% 30% 30% 40% >| | ||
| ^ Category ^ Search Term ^ Equivalents ^ | ^ Category ^ Search Term ^ Equivalents ^ | ||
| |Street Types |Ave, St, Blvd |Avenue, Street, Boulevard | | |Street Types |Ave, St, Blvd |Avenue, Street, Boulevard | | ||
| Line 96: | Line 102: | ||
| |Unit Types |Apt, Ste, Rm |Apartment, Suite, Room | | |Unit Types |Apt, Ste, Rm |Apartment, Suite, Room | | ||
| |Street Numbers |12345 |13245, 15324, 1234, 2345 | | |Street Numbers |12345 |13245, 15324, 1234, 2345 | | ||
| - | |------------------------------------------|------------------------------------------|----------------------------------------------------------------------| | ||
| Line 107: | Line 112: | ||
| 'SYNONYMS=ALL_ADDRESS_LINES,MISSPELLINGS') ... | 'SYNONYMS=ALL_ADDRESS_LINES,MISSPELLINGS') ... | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === City === | === City === | ||
| - | Some cities have common abbreviations and others can be easily misspelled. PowerSearch will automatically look for common abbreviations and misspellings. | + | PowerSearch uses a cities synonym list, combined with misspelling algorithms, to search city names. For example: |
| - | Here are some examples: | ||
| + | |< 85% 30% 30% 40% >| | ||
| ^ Category ^ Search Term ^ Equivalents ^ | ^ Category ^ Search Term ^ Equivalents ^ | ||
| |Abbreviations |SF, LA, NY |San Francisco, Los Angeles, New York | | |Abbreviations |SF, LA, NY |San Francisco, Los Angeles, New York | | ||
| |Misspellings |Milwaukee |Milwalkee, Milwauki, Milwalke | | |Misspellings |Milwaukee |Milwalkee, Milwauki, Milwalke | | ||
| - | |------------------------------------------|------------------------------------------|----------------------------------------------------------------------| | ||
| The SQL syntax for city synonym searches and misspelling searches is shown below. | The SQL syntax for city synonym searches and misspelling searches is shown below. | ||
| Line 127: | Line 134: | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Zip Code === | === Zip Code === | ||
| - | Zip codes are sometimes guessed based on their approximate geographic location. PowerSearch will automatically search for zipcodes that are geographically adjacent to this zip code. | + | PowerSearch uses a geographic radius search to locate zip codes that are within a certain distance from the named zip code. This is an example of a PowerSearch search that does not use the $CONTAINS function. Instead, it uses the [[admin:features:geo:home|$DISTANCE function]] to perform the radius search. This search requires that the database have a table of postal codes that includes their geographic coordinates. |
| Here are some examples: | Here are some examples: | ||
| + | |< 85% 30% 30% 40% >| | ||
| ^ Zip Code ^ Adjacent Zip Code ^ Distance ^ | ^ Zip Code ^ Adjacent Zip Code ^ Distance ^ | ||
| - | |10021 |10162 |.48 miles | | + | |10021\\ \\ \\ \\ \\ \\ |10162\\ 10155\\ 10028\\ 10044\\ 10052\\ 10022 |.48 miles\\ .64 miles\\ .67 miles\\ .73 miles\\ .80 miles\\ .82 miles | |
| - | | |10155 |.64 miles | | + | |
| - | | |10028 |.67 miles | | + | |
| - | | |10044 |.73 miles | | + | |
| - | | |10052 |.80 miles | | + | |
| - | | |10022 |.82 miles | | + | |
| - | |------------------------------------------|------------------------------------------|----------------------------------------------------------------------| | + | |
| The SQL syntax for zip code geographic radius searches is shown below. | The SQL syntax for zip code geographic radius searches is shown below. | ||
| Line 159: | Line 163: | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Phone Area Code === | === Phone Area Code === | ||
| - | + | PowerSearch uses an area code synonym list to locate area codes that are shared within the same metropolitan area. | |
| - | Some metropolitan areas use multiple area codes, leading people to be unsure which area code to use. PowerSearch will automatically search the alternate area codes. | + | |
| Here are some examples: | Here are some examples: | ||
| + | |< 85% 30% 70% >| | ||
| ^ Metropolitan Area ^ Area Codes ^ | ^ Metropolitan Area ^ Area Codes ^ | ||
| |New York, NY |212, 646, 917 | | |New York, NY |212, 646, 917 | | ||
| |Denver, CO |303, 720 | | |Denver, CO |303, 720 | | ||
| |Seattle, WA |206, 360, 253, 425, 564 | | |Seattle, WA |206, 360, 253, 425, 564 | | ||
| - | |------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | ||
| The SQL syntax for telephone area code synonym searches is shown below. | The SQL syntax for telephone area code synonym searches is shown below. | ||
| Line 179: | Line 184: | ||
| where $contains(PHONE1_AREA, '917', 'SYNONYMS=AREACODES') ... | where $contains(PHONE1_AREA, '917', 'SYNONYMS=AREACODES') ... | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Phone Prefix and Suffix === | === Phone Prefix and Suffix === | ||
| - | Telephone numbers are easy to transpose or mistype. PowerSearch will automatically search for transpositions and typographical errors in your telephone numbers. | + | PowerSearch uses a transposition search to locate telephone numbers that have been transposed or mistyped. |
| Here are some examples: | Here are some examples: | ||
| + | |< 85% 30% 70% >| | ||
| ^ Phone Number ^ Transposition ^ | ^ Phone Number ^ Transposition ^ | ||
| |775-4866 | 755-4846 | | |775-4866 | 755-4846 | | ||
| |831-6584 | 381-8564 | | |831-6584 | 381-8564 | | ||
| - | |------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | ||
| The SQL Syntax for telephone number transposition searches is shown below. | The SQL Syntax for telephone number transposition searches is shown below. | ||
| Line 195: | Line 202: | ||
| select ... | select ... | ||
| from ... | from ... | ||
| - | where $contains(PHONE1_PREFIX, '755', 'MISSPELLINGS MIN_SCORE=70') and \ | + | where $contains(PHONE1_PREFIX, '755', 'MISSPELLINGS MIN_SCORE=70') and |
| $contains(PHONE1_SUFFIX, '4686', 'MISSPELLINGS MIN_SCORE=70') ... | $contains(PHONE1_SUFFIX, '4686', 'MISSPELLINGS MIN_SCORE=70') ... | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Email === | === Email === | ||
| - | This column contains the e-mail address for the individual. You may also enter just the mailbox name or the domain name. For example, you may enter 'mailbox@domain.com' , or just 'mailbox', or just 'domain.com'. PowerSearch will additionally search for phonetic equivalents or misspellings of your email address. | + | PowerSearch uses a standard misspelling search to locate email addresses that have similar spellings. The SQL syntax for email misspelling searches is shown below. |
| <code sql> | <code sql> | ||
| Line 210: | Line 219: | ||
| </code> | </code> | ||
| + | \\ | ||
| + | ---- | ||
| === Final SQL Statement === | === Final SQL Statement === | ||
| Line 220: | Line 231: | ||
| $contains(LNAME, 'Meyers', 'PHONETIC') and | $contains(LNAME, 'Meyers', 'PHONETIC') and | ||
| $contains(ADDRESS1, '825 Fifth Avenue', | $contains(ADDRESS1, '825 Fifth Avenue', | ||
| - | 'SYNONYMS=ALL_ADDRESS_LINES,MISSPELLINGS') and | + | 'SYNONYMS=ALL_ADDRESS_LINES,MISSPELLINGS') and |
| $contains(CITY, 'NY', 'SYNONYMS=CITY_ABBR,MISSPELLINGS') and | $contains(CITY, 'NY', 'SYNONYMS=CITY_ABBR,MISSPELLINGS') and | ||
| LIST.STATE = 'NY' and | LIST.STATE = 'NY' and | ||