aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/prelude/fastsearch/DataField.java
blob: dc7d6926b3af68415e2a531348d0bb71a091afdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * Class representing a data field in the result set.  a data field
 * is basically the same thing as a string field, only that we
 * treat it like a raw buffer.  Well we SHOULD.  we don't actually
 * do so.  yet.  we should probably do some defensive copying and
 * return a ByteBuffer...hmm...
 *
 */

package com.yahoo.prelude.fastsearch;

import com.yahoo.prelude.hitfield.RawData;
import com.yahoo.data.access.simple.Value;
import com.yahoo.data.access.Inspector;

/**
 * @author Bjørn Borud
 */
public class DataField extends DocsumField {

    public DataField(String name) {
        super(name);
    }

    private RawData convert(byte[] value) {
        return new RawData(value);
    }

    @Override
    public String toString() {
        return "field " + getName() + " type data";
    }

    @Override
    public Object convert(Inspector value) {
        return convert(value.asData(Value.empty().asData()));
    }

}