

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在路徑擷取器中使用搜尋路徑
<a name="ion-serde-using-search-paths-in-path-extractors"></a>

路徑擷取器的 SerDe 屬性語法包含 *<path\$1extractor\$1expression>*：

```
"ion.<column_name>.path_extractor" = "<path_extractor_expression>"         
```

您可以使用 *<path\$1extractor\$1expression>* 來指定用於剖析 Amazon Ion 文件並尋找相符資料的搜尋路徑。搜尋路徑含括在括號內，並且可以包含以下一個或多個由空格分隔的元件。
+ **萬用字元** – 符合所有值。
+ **索引** – 符合指定數字索引位置的值。索引以零為起始。
+ **文字** – 符合欄位名稱與指定文字相符的所有值。
+ **註釋** – 符合具有指定註釋的包裝路徑元件指定的值。

下列範例說明了 Amazon Ion 文件和一些搜尋路徑範例。

```
-- Amazon Ion document
{
    foo: ["foo1", "foo2"] ,
    bar: "myBarValue", 
    bar: A::"annotatedValue"
}

-- Example search paths
(foo 0)       # matches "foo1"
(1)           # matches "myBarValue"
(*)           # matches ["foo1", "foo2"], "myBarValue" and A::"annotatedValue"
()            # matches {foo: ["foo1", "foo2"] , bar: "myBarValue", bar: A::"annotatedValue"}
(bar)         # matches "myBarValue" and A::"annotatedValue"
(A::bar)      # matches A::"annotatedValue"
```