Tabnine Logo
SearchResult.setIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
setIndex
method
in
org.apache.metron.indexing.dao.search.SearchResult

Best Java code snippets using org.apache.metron.indexing.dao.search.SearchResult.setIndex (Showing top 3 results out of 315)

origin: apache/metron

public static SearchResult getSearchResult(SolrDocument solrDocument, List<String> fields, Function<String, String> indexSupplier) {
 SearchResult searchResult = new SearchResult();
 searchResult.setId((String) solrDocument.getFieldValue(Constants.GUID));
 searchResult.setIndex(indexSupplier.apply((String) solrDocument.getFieldValue(Constants.SENSOR_TYPE)));
 Map<String, Object> docSource = toDocument(solrDocument).getDocument();
 final Map<String, Object> source = new HashMap<>();
 if (fields != null) {
  fields.forEach(field -> source.put(field, docSource.get(field)));
 } else {
  source.putAll(docSource);
 }
 searchResult.setSource(source);
 return searchResult;
}
origin: apache/metron

 /**
  * Transforms a list of Elasticsearch SearchHits to a list of SearchResults
  * @param searchResponse An Elasticsearch SearchHit to be converted.
  * @return The list of SearchResults for the SearchHit
  */
 protected static List<SearchResult> getSearchResults(
   org.elasticsearch.action.search.SearchResponse searchResponse) {
  return Arrays.stream(searchResponse.getHits().getHits()).map(searchHit -> {
     SearchResult searchResult = new SearchResult();
     searchResult.setId(searchHit.getId());
     searchResult.setSource(searchHit.getSource());
     searchResult.setScore(searchHit.getScore());
     searchResult.setIndex(searchHit.getIndex());
     return searchResult;
    }
  ).collect(Collectors.toList());
 }
}
origin: apache/metron

private SearchResult getSearchResult(SearchHit searchHit, List<String> fields) {
 SearchResult searchResult = new SearchResult();
 searchResult.setId(searchHit.getId());
 Map<String, Object> source;
 if (fields != null) {
  Map<String, Object> resultSourceAsMap = searchHit.getSourceAsMap();
  source = new HashMap<>();
  fields.forEach(field -> {
   source.put(field, resultSourceAsMap.get(field));
  });
 } else {
  source = searchHit.getSource();
 }
 searchResult.setSource(source);
 searchResult.setScore(searchHit.getScore());
 searchResult.setIndex(searchHit.getIndex());
 return searchResult;
}
org.apache.metron.indexing.dao.searchSearchResultsetIndex

Popular methods of SearchResult

  • getSource
    The source (the actual result).
  • <init>
  • getId
    The ID of the document from the index.
  • setId
  • setSource
  • getIndex
    The index that the result comes from
  • setScore
  • getScore
    The score from the index.

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • onCreateOptionsMenu (Activity)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JPanel (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now