aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.h
blob: fd776b92d76a39c2943b7c248035512e5810df79 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchcommon/common/datatype.h>
#include <vespa/document/fieldvalue/structfieldvalue.h>

namespace search::memoryindex {

class FieldInverter;

class UrlFieldInverter {
    FieldInverter *_all;
    FieldInverter *_scheme;
    FieldInverter *_host;
    FieldInverter *_port;
    FieldInverter *_path;
    FieldInverter *_query;
    FieldInverter *_fragment;
    FieldInverter *_hostname;

    index::schema::CollectionType _collectionType;

    void startDoc(uint32_t docId);

    void endDoc();

    void startElement(int32_t weight);

    void endElement();

    void processUrlField(const document::FieldValue &url_field, const document::Document& doc);

    void processUrlOldStyle(const vespalib::string &s, const document::Document& doc);

    void processArrayUrlField(const document::ArrayFieldValue &field, const document::Document& doc);

    void processWeightedSetUrlField(const document::WeightedSetFieldValue &field, const document::Document& doc);

    void invertUrlField(const document::FieldValue &field, const document::Document& doc);
public:
    UrlFieldInverter(index::schema::CollectionType collectionType,
                     FieldInverter *all,
                     FieldInverter *scheme,
                     FieldInverter *host,
                     FieldInverter *port,
                     FieldInverter *path,
                     FieldInverter *query,
                     FieldInverter *fragment,
                     FieldInverter *hostname);

    void invertField(uint32_t docId, const document::FieldValue::UP &field, const document::Document& doc);
    void removeDocument(uint32_t docId);

    void applyRemoves();
    void pushDocuments();
};

}