use of com.yahoo.language.process.StemMode in project vespa by vespa-engine.
the class StemmingSearcher method search.
@Override
public Result search(Query query, Execution execution) {
if (query.properties().getBoolean(DISABLE))
return execution.search(query);
IndexFacts.Session indexFacts = execution.context().getIndexFacts().newSession(query);
Item newRoot = replaceTerms(query, indexFacts);
query.getModel().getQueryTree().setRoot(newRoot);
query.trace(getFunctionName(), true, 2);
Highlight highlight = query.getPresentation().getHighlight();
if (highlight != null) {
Set<String> highlightFields = highlight.getHighlightItems().keySet();
for (String field : highlightFields) {
StemMode stemMode = indexFacts.getIndex(field).getStemMode();
if (stemMode != StemMode.NONE) {
Item newHighlight = scan(highlight.getHighlightItems().get(field), false, Language.ENGLISH, indexFacts, null);
highlight.getHighlightItems().put(field, (AndItem) newHighlight);
}
}
}
return execution.search(query);
}
use of com.yahoo.language.process.StemMode in project vespa by vespa-engine.
the class StemmingSearcher method checkBlock.
private Item checkBlock(BlockItem b, boolean isCJK, Language language, IndexFacts.Session indexFacts, Map<Item, TaggableItem> reverseConnectivity) {
if (b instanceof PrefixItem || !b.isWords())
return (Item) b;
if (b.isFromQuery() && !b.isStemmed()) {
Index index = indexFacts.getIndex(b.getIndexName());
StemMode stemMode = index.getStemMode();
if (stemMode != StemMode.NONE)
return stem(b, isCJK, language, reverseConnectivity, index);
}
return (Item) b;
}
use of com.yahoo.language.process.StemMode in project vespa by vespa-engine.
the class AnnotatorConfigTestCase method requireThatAccessorsWork.
@Test
public void requireThatAccessorsWork() {
AnnotatorConfig config = new AnnotatorConfig();
for (Language language : Language.values()) {
config.setLanguage(language);
assertEquals(language, config.getLanguage());
}
for (StemMode mode : StemMode.values()) {
config.setStemMode(mode);
assertEquals(mode, config.getStemMode());
}
config.setRemoveAccents(true);
assertTrue(config.getRemoveAccents());
config.setRemoveAccents(false);
assertFalse(config.getRemoveAccents());
}
Aggregations