Skip to content

Commit

Permalink
Added field mappings which were missing for autocomplete search.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmrsulja committed Dec 9, 2024
1 parent a5dc6ea commit 8b659c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
import edu.cornell.mannlib.vitro.webapp.utils.http.HttpClientFactory;
import edu.cornell.mannlib.vitro.webapp.utils.http.ESHttpsBasicClientFactory;
import org.apache.commons.logging.Log;
Expand Down Expand Up @@ -51,6 +52,12 @@ private void addDocument(SearchInputDocument doc)
throws SearchEngineException {
try {
Map<String, List<Object>> map = convertDocToMap(doc);

if (map.containsKey(VitroSearchTermNames.NAME_RAW)) {
map.putIfAbsent(VitroSearchTermNames.AC_NAME_STEMMED, map.get(VitroSearchTermNames.NAME_RAW));
map.putIfAbsent(VitroSearchTermNames.AC_NAME_UNTOKENIZED, map.get(VitroSearchTermNames.NAME_RAW));
}

String json = new ObjectMapper().writeValueAsString(map);
if (json.contains("_drsim")) {
json = reformatDRSIMFields(json);
Expand Down
28 changes: 15 additions & 13 deletions home/src/main/resources/config/example.applicationSetup.n3
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,31 @@
# ----------------------------
#
# Search engine module:
# The Solr-based implementation is the only standard option, but it can be
# The Solr-based implementation is the standard option and it can be
# wrapped in an "instrumented" wrapper, which provides additional logging
# and more rigorous life-cycle checking.
#

#:instrumentedSearchEngineWrapper
# a vitroWebapp:searchengine.InstrumentedSearchEngineWrapper ,
# vitroWebapp:modules.searchEngine.SearchEngine ;
# :wraps :solrSearchEngine .

#:solrSearchEngine
# a vitroWebapp:searchengine.solr.SolrSearchEngine ,
# vitroWebapp:modules.searchEngine.SearchEngine .

:instrumentedSearchEngineWrapper
a vitroWebapp:searchengine.InstrumentedSearchEngineWrapper ,
vitroWebapp:modules.searchEngine.SearchEngine ;
:wraps :elasticSearchEngine .
:wraps :solrSearchEngine .

:elasticSearchEngine
a vitroWebapp:searchengine.elasticsearch.ElasticSearchEngine ,
:solrSearchEngine
a vitroWebapp:searchengine.solr.SolrSearchEngine ,
vitroWebapp:modules.searchEngine.SearchEngine .

# Alternatively, you can setup Elasticsearch engine in the same manner:

#:instrumentedSearchEngineWrapper
# a vitroWebapp:searchengine.InstrumentedSearchEngineWrapper ,
# vitroWebapp:modules.searchEngine.SearchEngine ;
# :wraps :elasticSearchEngine .

#:elasticSearchEngine
# a vitroWebapp:searchengine.elasticsearch.ElasticSearchEngine ,
# vitroWebapp:modules.searchEngine.SearchEngine .

# ----------------------------
#
# Search indexer module:
Expand Down

0 comments on commit 8b659c1

Please sign in to comment.