blob: 24b811fc7fcb9a28773cc9ec6f70bf1b7065cead (
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition.processing;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.document.Matching;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.searchdefinition.Search;
import com.yahoo.vespa.model.container.search.QueryProfiles;
/**
* The implementation of word matching - with word matching the field is assumed to contain a single "word" - some
* contiguous sequence of word and number characters - but without changing the data at the indexing side (as with text
* matching) to enforce this. Word matching is thus almost like exact matching on the indexing side (no action taken),
* and like text matching on the query side. This may be suitable for attributes, where people both expect the data to
* be left as in the input document, and trivially written queries to work by default. However, this may easily lead to
* data which cannot be matched at all as the indexing and query side does not agree.
*
* @author <a href="mailto:bratseth@yahoo-inc.com">Jon Bratseth</a>
*/
public class WordMatch extends Processor {
public WordMatch(Search search, DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry, QueryProfiles queryProfiles) {
super(search, deployLogger, rankProfileRegistry, queryProfiles);
}
public void process() {
for (SDField field : search.allFieldsList()) {
if (!field.getMatching().getType().equals(Matching.Type.WORD)) {
continue;
}
field.setStemming(Stemming.NONE);
field.getNormalizing().inferLowercase();
field.addQueryCommand("word");
}
}
}
|