Skip to content

Commit

Permalink
[Javadocs] add to o.o.dfs,fetch,internal,lookup,profile, and query pa…
Browse files Browse the repository at this point in the history
…ckages (#3261)

Adds class level javadocs to org.opensearch.dfs, fetch, internal, lookup,
profile, and query packages.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
  • Loading branch information
nknize authored May 9, 2022
1 parent 625623f commit 1118dcf
Show file tree
Hide file tree
Showing 118 changed files with 418 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@

import java.io.IOException;

/**
* Compute global distributed frequency across the index
*
* @opensearch.internal
*/
public class AggregatedDfs implements Writeable {

private ObjectObjectHashMap<Term, TermStatistics> termStatistics;
Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/search/dfs/DfsPhase.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
/**
* Dfs phase of a search request, used to make scoring 100% accurate by collecting additional info from each shard before the query phase.
* The additional information is used to better compare the scores coming from all the shards, which depend on local factors (e.g. idf)
*
* @opensearch.internal
*/
public class DfsPhase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@

import java.io.IOException;

/**
* Thrown if there are any errors in the DFS phase
*
* @opensearch.internal
*/
public class DfsPhaseExecutionException extends SearchException {

public DfsPhaseExecutionException(SearchShardTarget shardTarget, String msg, Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@

import java.io.IOException;

/**
* Result from a Distributed Frequency Search phase
*
* @opensearch.internal
*/
public class DfsSearchResult extends SearchPhaseResult {

private static final Term[] EMPTY_TERMS = new Term[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

/**
* Encapsulates state required to execute fetch phases
*
* @opensearch.internal
*/
public class FetchContext {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
/**
* Fetch phase of a search request, used to fetch the actual top matching documents to be returned to the client, identified
* after reducing all of the matches returned by the query phase
*
* @opensearch.internal
*/
public class FetchPhase {
private static final Logger LOGGER = LogManager.getLogger(FetchPhase.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@

import java.io.IOException;

/**
* Thrown when there are errors during the fetch phase
*
* @opensearch.internal
*/
public class FetchPhaseExecutionException extends SearchException {

public FetchPhaseExecutionException(SearchShardTarget shardTarget, String msg, Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@

import java.io.IOException;

/**
* Result from a fetch
*
* @opensearch.internal
*/
public final class FetchSearchResult extends SearchPhaseResult {

private SearchHits hits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

/**
* Sub phase within the fetch phase used to fetch things *about* the documents like highlighting or matched queries.
*
* @opensearch.internal
*/
public interface FetchSubPhase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

/**
* Executes the logic for a {@link FetchSubPhase} against a particular leaf reader and hit
*
* @opensearch.internal
*/
public interface FetchSubPhaseProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@

import java.io.IOException;

/**
* Query fetch result
*
* @opensearch.internal
*/
public final class QueryFetchSearchResult extends SearchPhaseResult {

private final QuerySearchResult queryResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@

import java.io.IOException;

/**
* Scroll fetch result
*
* @opensearch.internal
*/
public final class ScrollQueryFetchSearchResult extends SearchPhaseResult {

private final QueryFetchSearchResult result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
/**
* Shard level fetch base request. Holds all the info needed to execute a fetch.
* Used with search scroll as the original request doesn't hold indices.
*
* @opensearch.internal
*/
public class ShardFetchRequest extends TransportRequest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
/**
* Shard level fetch request used with search. Holds indices taken from the original search request
* and implements {@link org.opensearch.action.IndicesRequest}.
*
* @opensearch.internal
*/
public class ShardFetchSearchRequest extends ShardFetchRequest implements IndicesRequest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

/**
* Context used to fetch the {@code stored_fields}.
*
* @opensearch.internal
*/
public class StoredFieldsContext implements Writeable {
public static final String _NONE_ = "_none_";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

/**
* Explains the scoring calculations for the top hits.
*
* @opensearch.internal
*/
public final class ExplainPhase implements FetchSubPhase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

/**
* All the required context to pull a field from the doc values.
*
* @opensearch.internal
*/
public class FetchDocValuesContext {
private final List<FieldAndFormat> fields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
* Fetch sub phase which pulls data from doc values.
*
* Specifying {@code "docvalue_fields": ["field1", "field2"]}
*
* @opensearch.internal
*/
public final class FetchDocValuesPhase implements FetchSubPhase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

/**
* The context needed to retrieve fields.
*
* @opensearch.internal
*/
public class FetchFieldsContext {
private final List<FieldAndFormat> fields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
/**
* A fetch sub-phase for high-level field retrieval. Given a list of fields, it
* retrieves the field values from _source and returns them as document fields.
*
* @opensearch.internal
*/
public final class FetchFieldsPhase implements FetchSubPhase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@

import java.io.IOException;

/**
* Fetches the score of a query match during search phase
*
* @opensearch.internal
*/
public class FetchScorePhase implements FetchSubPhase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

/**
* Context used to fetch the {@code _source}.
*
* @opensearch.internal
*/
public class FetchSourceContext implements Writeable, ToXContentObject {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
import java.io.IOException;
import java.util.Map;

/**
* Fetches the document source during search phase
*
* @opensearch.internal
*/
public final class FetchSourcePhase implements FetchSubPhase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@

import java.io.IOException;

/**
* Fetches the version of a term during search phase
*
* @opensearch.internal
*/
public final class FetchVersionPhase implements FetchSubPhase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
/**
* Wrapper around a field name and the format that should be used to
* display values of this field.
*
* @opensearch.internal
*/
public final class FieldAndFormat implements Writeable, ToXContentObject {
private static final ParseField FIELD_FIELD = new ParseField("field");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
/**
* A helper class to {@link FetchFieldsPhase} that's initialized with a list of field patterns to fetch.
* Then given a specific document, it can retrieve the corresponding fields from the document's source.
*
* @opensearch.internal
*/
public class FieldFetcher {
public static FieldFetcher create(QueryShardContext context, SearchLookup searchLookup, Collection<FieldAndFormat> fieldAndFormats) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

/**
* Context used for inner hits retrieval
*
* @opensearch.internal
*/
public final class InnerHitsContext {
private final Map<String, InnerHitSubContext> innerHits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
import java.util.HashMap;
import java.util.Map;

/**
* Gets the inner hits of a document during search
*
* @opensearch.internal
*/
public final class InnerHitsPhase implements FetchSubPhase {

private final FetchPhase fetchPhase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
import java.util.List;
import java.util.Map;

/**
* Fetches queries that match the document during search phase
*
* @opensearch.internal
*/
public final class MatchedQueriesPhase implements FetchSubPhase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
import java.util.ArrayList;
import java.util.List;

/**
* Context used for script fields
*
* @opensearch.internal
*/
public class ScriptFieldsContext {

public static class ScriptField {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
import java.util.Collections;
import java.util.List;

/**
* Gets the scripted fields during search phase
*
* @opensearch.internal
*/
public final class ScriptFieldsPhase implements FetchSubPhase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@

import java.io.IOException;

/**
* Fetches the sequence number of the primary term during search phase
*
* @opensearch.internal
*/
public final class SeqNoPrimaryTermPhase implements FetchSubPhase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
/**
* This abstract class holds parameters shared by {@link HighlightBuilder} and {@link HighlightBuilder.Field}
* and provides the common setters, equality, hashCode calculation and common serialization
*
* @opensearch.internal
*/
public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterBuilder<?>>
implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
import java.io.IOException;
import java.util.Map;

/**
* Internally used for custom scoring
*
* @opensearch.internal
*/
public final class CustomQueryScorer extends QueryScorer {

public CustomQueryScorer(Query query, IndexReader reader, String field, String defaultField) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
import java.util.Map;
import java.util.function.Function;

/**
* Uses Lucene's Fast Vector Highlighting
*
* @opensearch.internal
*/
public class FastVectorHighlighter implements Highlighter {
private static final BoundaryScanner DEFAULT_SIMPLE_BOUNDARY_SCANNER = new SimpleBoundaryScanner();
private static final BoundaryScanner DEFAULT_SENTENCE_BOUNDARY_SCANNER = new BreakIteratorBoundaryScanner(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@

import java.util.Map;

/**
* Context used during field level highlighting
*
* @opensearch.internal
*/
public class FieldHighlightContext {

public final String fieldName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

/**
* Simple helper class for {@link FastVectorHighlighter} {@link FragmentsBuilder} implementations.
*
* @opensearch.internal
*/
public final class FragmentBuilderHelper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
* are summarized to show only selected snippets ("fragments") containing search terms.
*
* @see org.opensearch.search.builder.SearchSourceBuilder#highlight()
*
* @opensearch.internal
*/
public class HighlightBuilder extends AbstractHighlighterBuilder<HighlightBuilder> {
/** default for whether to highlight fields based on the source even if stored separately */
Expand Down
Loading

0 comments on commit 1118dcf

Please sign in to comment.