# Search Boundaries

AddressZen offers a suite of advanced features to tailor the address lookup functionality to your specific needs. This guide outlines how to implement Bias By IP, Filter By Country, Exclude Islands, Exclude Military Addresses, and Exclude PO Boxes, enabling a more customized and relevant user experience.

## Bias By IP[​](#bias-by-ip "Direct link to Bias By IP")

Biasing search results based on the user's approximate geolocation, derived from their IP address. This capability enhances the relevance of address suggestions by prioritizing options that are geographically closer to the user's current location.

To enable IP-based biasing in your AddressZen Address Lookup setup, you will need to set the `bias_ip` option to `true` within the `queryOptions`. Here's how you can do it:

Loading...

```
<form>
<label for="line_1">Address First Line</label>
<input type="text" id="line_1" />
<label for="line_2">Address Second Line</label>
<input type="text" id="line_2" />
<label for="city">City</label>
<input type="text" id="city" />
<label for="state">State</label>
<input type="text" id="state" />
<label for="zipcode">Zip Code</label>
<input type="text" id="zipcode" />
</form>
```

```

import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
  apiKey: "ak_test",
  queryOptions: {
    // Set IP bias to prioritize addresses based on user's IP location
    bias_ip: "true",
  },
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    city: "#city",
    state: "#state",
    zip_plus_4_code: "#zipcode",
  },
});
```

***

## Exclude Islands[​](#exclude-islands "Direct link to Exclude Islands")

To exclude addresses located on U.S. islands from the suggestions list in your setup, ensuring that your application only provides suggestions for addresses in the contiguous United States or specific areas according to your needs, you can utilize the `set` option within the `queryOptions`. This feature is particularly useful for services that do not operate or deliver to U.S. islands due to logistical constraints. Here's how you can do it:

Loading...

```
<form>
<label for="line_1">Address First Line</label>
<input type="text" id="line_1" />
<label for="line_2">Address Second Line</label>
<input type="text" id="line_2" />
<label for="city">City</label>
<input type="text" id="city" />
<label for="state">State</label>
<input type="text" id="state" />
<label for="zipcode">Zip Code</label>
<input type="text" id="zipcode" />
</form>
```

```

import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
  apiKey: "ak_test",
  queryOptions: {
    set: "insular",
  },
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    city: "#city",
    state: "#state",
    zip_plus_4_code: "#zipcode",
  },
});
```

***

## Exclude Military Addresses[​](#exclude-military-addresses "Direct link to Exclude Military Addresses")

To exclude military addresses from the suggestions list in your results, ensuring that your application focuses on civilian addresses, you can use the `set` option within the `queryOptions`. This feature is useful for services that are unable to deliver or provide services to military addresses due to various logistical or regulatory reasons. Here's how you can do it:

Loading...

```
<form>
<label for="line_1">Address First Line</label>
<input type="text" id="line_1" />
<label for="line_2">Address Second Line</label>
<input type="text" id="line_2" />
<label for="city">City</label>
<input type="text" id="city" />
<label for="state">State</label>
<input type="text" id="state" />
<label for="zipcode">Zip Code</label>
<input type="text" id="zipcode" />
</form>
```

```

import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
  apiKey: "ak_test",
  queryOptions: {
    set: "nomilitary",
  },
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    city: "#city",
    state: "#state",
    zip_plus_4_code: "#zipcode",
  },
});
```

***

## Exclude PO Box[​](#exclude-po-box "Direct link to Exclude PO Box")

To exclude PO Box addresses from the suggestions in your results, ensuring that only physical addresses are provided to users, you can utilize the `set` option within the `queryOptions` of your AddressZen setup. This feature is particularly useful for services that require delivery to physical locations and cannot deliver to PO Boxes, such as certain shipping or delivery services. Here's how you can do it:

Loading...

```
<form>
<label for="line_1">Address First Line</label>
<input type="text" id="line_1" />
<label for="line_2">Address Second Line</label>
<input type="text" id="line_2" />
<label for="city">City</label>
<input type="text" id="city" />
<label for="state">State</label>
<input type="text" id="state" />
<label for="zipcode">Zip Code</label>
<input type="text" id="zipcode" />
</form>
```

```

import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
  apiKey: "ak_test",
  queryOptions: {
    set: "nopobox",
  },
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    city: "#city",
    state: "#state",
    zip_plus_4_code: "#zipcode",
  },
});
```

***

## Restricting to Specific States[​](#restricting-to-specific-states "Direct link to Restricting to Specific States")

To tailor your address lookup functionality to support only certain states, you can specify these states in the AddressZen setup. This is particularly useful if your service or application operates in specific geographic areas.

Loading...

```
<form>
<label for="line_1">Address First Line</label>
<input type="text" id="line_1" />
<label for="line_2">Address Second Line</label>
<input type="text" id="line_2" />
<label for="city">City</label>
<input type="text" id="city" />
<label for="state">State</label>
<input type="text" id="state" />
<label for="zipcode">Zip Code</label>
<input type="text" id="zipcode" />
</form>
```

```

import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
  apiKey: "ak_test",
  queryOptions: {
    state: "California",
  },
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    city: "#city",
    state: "#state",
    zip_plus_4_code: "#zipcode",
  },
});
```

***

## Restricting to Mainland US Addresses[​](#restricting-to-mainland-us-addresses "Direct link to Restricting to Mainland US Addresses")

If your application's scope is limited to the mainland United States, excluding addresses from territories and outlying islands can streamline the user experience by providing more relevant suggestions.

Loading...

```
<form>
<label for="line_1">Address First Line</label>
<input type="text" id="line_1" />
<label for="line_2">Address Second Line</label>
<input type="text" id="line_2" />
<label for="city">City</label>
<input type="text" id="city" />
<label for="state">State</label>
<input type="text" id="state" />
<label for="zipcode">Zip Code</label>
<input type="text" id="zipcode" />
</form>
```

```

import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
  apiKey: "ak_test",
  queryOptions: {
    set: "contiguous",
  },
  outputFields: {
    line_1: "#line_1",
    line_2: "#line_2",
    city: "#city",
    state: "#state",
    zip_plus_4_code: "#zipcode",
  },
});
```
