# Search & Autocomplete

## Fulltext

This endpoint is designed for comprehensive search queries where multiple terms or a full-text scan are required.

1. `type`: Search Mode
   1. `Exact`: Search for an exact single word.
   2. `Like`: Left-aligned search starting from the beginning of a single word, considering partial words throughout the entire word.
   3. `Phonetic`: Search with phonetic matching to find similar terms.
2. `source`: Data source where the search is performed. Available options:
   1. `etc` - search.ch private listings
   2. `etb` - search.ch business listings
3. `resultThreshold`: Minimum number of results that should be displayed.
4. `resultMaximum`: Maximum number of results that should be returned.
5. `includeCount`: Indicates whether the total number of hits should be included in the response (`true`/`false`).
6. `includeData`: Indicates whether detailed information about the hits should be included in the response (`true`/`false`).
7. `search`: Search term or search phrase.

## POST /Search/Fulltext

>

```json
{"openapi":"3.0.1","info":{"title":"multisource•api ","version":"v2"},"tags":[{"name":"Search"}],"servers":[{"url":"https://api.multisource.ch/v2","description":"Production - v2"},{"url":"https://api.multisource.ch","description":"Production"},{"url":"https://apitep.multisource.ch","description":"Pre-Production Testing"}],"security":[{"auth-key":[]}],"components":{"securitySchemes":{"auth-key":{"type":"apiKey","description":"API Key required for authorized endpoints","name":"auth-key","in":"header"}},"schemas":{"InputSearchOfstring":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/SearchType"},"likeType":{"$ref":"#/components/schemas/LikeType"},"source":{"type":"string"},"resultThreshold":{"type":"integer","format":"int32"},"resultMaximum":{"type":"integer","format":"int32"},"includeCount":{"type":"boolean"},"includeData":{"type":"boolean"},"termOperation":{"$ref":"#/components/schemas/OperationType"},"search":{"type":"string"}}},"SearchType":{"enum":["0 = Exact","1 = Like","2 = Phonetic","3 = PhoneticLike"],"type":"integer"},"LikeType":{"enum":["0 = StartsWith","1 = EndsWith","2 = Contains","3 = StartOrEndWith"],"type":"integer"},"OperationType":{"enum":["0 = And","1 = Or"],"type":"integer"},"SearchOutputOfListOfOutputDataSearch":{"type":"object","properties":{"hitCount":{"type":"integer","format":"int32"},"resultCount":{"type":"integer","format":"int32"},"data":{"type":"array","items":{"$ref":"#/components/schemas/OutputDataSearch"}}}},"OutputDataSearch":{"type":"object","properties":{"dwhId":{"type":"string","nullable":true},"companyname":{"type":"string","nullable":true},"firstname":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"street":{"type":"string","nullable":true},"houseNumber":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"category":{"type":"object","additionalProperties":{"type":"string"},"nullable":true},"email":{"type":"string"},"url":{"type":"string"},"phoneNumbers":{"type":"array","items":{"type":"string"},"nullable":true},"mobileNumbers":{"type":"array","items":{"type":"string"},"nullable":true}}}}},"paths":{"/Search/Fulltext":{"post":{"tags":["Search"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputSearchOfstring"}},"text/json":{"schema":{"$ref":"#/components/schemas/InputSearchOfstring"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/InputSearchOfstring"}}},"required":true},"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputDataSearch"}},"application/json":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputDataSearch"}},"text/json":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputDataSearch"}}}}}}}}}
```

### Response Fields

#### Root-Level Fields

<table><thead><tr><th width="145">Field</th><th width="88">Type</th><th width="290">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>hitCount</code></td><td>integer</td><td>Total number of matches in the database for the query</td><td><code>1</code></td></tr><tr><td><code>resultCount</code></td><td>integer</td><td>Number of entries actually returned in the <code>data</code> array</td><td><code>1</code></td></tr><tr><td><code>data</code></td><td>array</td><td>Array containing the found directory entries</td><td>see entry fields below</td></tr></tbody></table>

#### Entry Fields

<table><thead><tr><th width="145">Field</th><th width="88">Type</th><th width="290">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>companyname</code></td><td>string</td><td>Company name for business entries</td><td><code>Swisscom Directories AG</code></td></tr><tr><td><code>firstname</code></td><td>string</td><td>First name for private individuals</td><td><code>Lara</code></td></tr><tr><td><code>name</code></td><td>string</td><td>Last name for private individuals</td><td><code>Graf</code></td></tr><tr><td><code>street</code></td><td>string</td><td>Street name</td><td><code>Förrlibuckstrasse</code></td></tr><tr><td><code>houseNumber</code></td><td>string</td><td>House number</td><td><code>62</code></td></tr><tr><td><code>zip</code></td><td>string</td><td> Postal code</td><td><code>8005</code></td></tr><tr><td><code>location</code></td><td>string</td><td>City or town name</td><td><code>Zürich</code></td></tr><tr><td><code>category</code></td><td>string</td><td><p>Category / industry</p><p>(multilingual: DE, FR, IT, EN)</p></td><td><p><code>"de": "Pizzakurier",</code></p><p><code>"en": "Pizza delivery",</code></p><p><code>"it": "Pizza consegne a domicilio",</code></p><p><code>"fr": Pizza livraison à domicile"</code></p></td></tr><tr><td><code>email</code></td><td>string</td><td>Email</td><td><code>info@abc.com</code></td></tr><tr><td><code>url</code></td><td>string</td><td>Website</td><td><code>www.multisource.ch</code></td></tr><tr><td><code>phoneNumbers</code></td><td>array</td><td>Array with one or more landline numbers</td><td><p><code>[</code></p><p><code>“*0800 123 456",</code></p><p><code>"*058 123 45 67"</code></p><p><code>]</code> </p></td></tr><tr><td><code>mobileNumbers</code></td><td>array</td><td>Array with one or more mobile numbers</td><td><p><code>[</code></p><p><code>“*079  123 45 67"</code></p><p><code>]</code></p></td></tr></tbody></table>

## Autocomplete

Designed for simple, field-based searches with live completion – ideal when users enter individual elements such as name or street and want to refine results in real time.

## GET /Search/AutoComplete

>

```json
{"openapi":"3.0.1","info":{"title":"multisource•api ","version":"v2"},"tags":[{"name":"Search"}],"servers":[{"url":"https://api.multisource.ch/v2","description":"Production - v2"},{"url":"https://api.multisource.ch","description":"Production"},{"url":"https://apitep.multisource.ch","description":"Pre-Production Testing"}],"security":[{"auth-key":[]}],"components":{"securitySchemes":{"auth-key":{"type":"apiKey","description":"API Key required for authorized endpoints","name":"auth-key","in":"header"}},"schemas":{"SearchType2":{"type":"integer","default":1},"SearchOutputOfListOfOutputAddress":{"type":"object","properties":{"hitCount":{"type":"integer","format":"int32"},"resultCount":{"type":"integer","format":"int32"},"data":{"type":"array","items":{"$ref":"#/components/schemas/OutputAddress"}}}},"OutputAddress":{"type":"object","properties":{"companyname":{"type":"string","nullable":true},"firstname":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"street":{"type":"string","nullable":true},"houseNumber":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"location":{"type":"string","nullable":true}}}}},"paths":{"/Search/AutoComplete":{"get":{"tags":["Search"],"parameters":[{"name":"source","in":"query","schema":{"type":"string"}},{"name":"value","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"$ref":"#/components/schemas/SearchType2"}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputAddress"}},"application/json":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputAddress"}},"text/json":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputAddress"}}}}}}}}}
```
