Blame view

src/site/markdown/search_component_prefix.md 2.85 KB
Matthijs Brouwer authored
1
#Prefix
Matthijs Brouwer authored
2
Matthijs Brouwer authored
3
Mtas can produce a list of available prefixes. To get this information, in Solr requests, besides the parameter to enable the [Mtas query component](search_component.html), the following parameter should be provided.
Matthijs Brouwer authored
4
5
6
7
8
9
10
11
12
13

| Parameter             | Value  | Obligatory  |
|-----------------------|--------|-------------|
| mtas.stats.prefix     | true   | yes         |

Information for multiple fields can be produced within the same request. To distinguish them, a unique identifier has to be provided for each of the required statistics. The list of available prefixes is independent of any restriction in the document set, and also prefixes of deleted documents can be taken into account when the core hasn't been optimized.

| Parameter                                       | Value        | Info                           | Obligatory  |
|-------------------------------------------------|--------------|--------------------------------|-------------|
| mtas.stats.prefix.\<identifier\>.key         | \<string\>   | key used in response           | no          |
Matthijs Brouwer authored
14
| mtas.stats.prefix.\<identifier\>.field       | \<string\>   | Mtas field                      | yes         |
Matthijs Brouwer authored
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

The *key* is added to the response and may be used to distinguish between multiple lists, and should therefore be unique. The response will contain three lists: prefixes strictly used for single position tokens, prefixes (also) used for multiple position tokens and prefixes used for multiple non adjacent positions. Notice that the last list will always be a subset of the second list.

## Examples
1. [Basic](#basic) : list of available prefixes.

<a name="basic"></a>  

### Basic

**Example**  
List of avilable prefixes.

**Request and response**  
`q=*%3A*&mtas=true&mtas.prefix=true&mtas.prefix.0.field=text&mtas.prefix.0.key=example+-+basic&rows=0&wt=json&indent=true`

``` json
"mtas":{
    "prefix":[{
        "key":"example - basic",
        "singlePosition":["feat.buiging",
          "feat.conjtype",
          "feat.dial",
          "feat.genus",
          "feat.getal",
          "feat.getal-n",
          "feat.graad",
          "feat.head",
          "feat.lwtype",
          "feat.naamval",
          "feat.npagr",
          "feat.ntype",
          "feat.numtype",
          "feat.pdtype",
          "feat.persoon",
          "feat.positie",
          "feat.pvagr",
          "feat.pvtijd",
          "feat.spectype",
          "feat.status",
          "feat.vwtype",
          "feat.vztype",
          "feat.wvorm",
          "lemma",
          "morpheme",
          "pos",
          "t",
          "t_lc"],
        "multiplePosition":["div",
          "entity",
          "head",
          "p",
          "s"],
        "setPosition":["entity"]}]}
```
Matthijs Brouwer authored
70
71
72
73

**Lucene**

To get a list of prefixes [directly in Lucene](installation_lucene.html), *ComponentPrefix* together with the provided *collect* method can be used.