public class TermsResultSet extends Object implements Serializable
TermsQuery
.
A terms result set is a set of terms, represented by their
termStrings
. Optionally termCounts
,
termDescriptions
, and termLengths
may also be available.Modifier and Type | Class and Description |
---|---|
static class |
TermsResultSet.Swapper
A
Swapper implementation for
TermsResultSet s. |
Modifier and Type | Field and Description |
---|---|
static TermsResultSet |
EMPTY
Constant representing the empty result set.
|
String[][][] |
originalTermStrings
This field is populated by the
groupByDescription(TermsResultSet...) method. |
int[] |
termCounts
The counts (numbers of occurrences) for the terms.
|
String[] |
termDescriptions
For annotation indexes, the term string is simply a URI in whatever format
is used by the
SemanticAnnotationHelper that was used to index the
annotations. |
int[] |
termLengths
The lengths (number of tokens) for the terms.
|
String[] |
termStrings
The strings for the terms.
|
Constructor and Description |
---|
TermsResultSet(String[] termStrings,
int[] termLengths,
int[] termCounts,
String[] termDescriptions) |
Modifier and Type | Method and Description |
---|---|
static TermsResultSet |
filterByDescriptionNot(TermsResultSet setToFilter,
String... bannedDescriptions)
Enumerates a result set and produces a new one after removing all the terms
with descriptions in the banned list.
|
String[][] |
getSubIndexTerms(int termPosition)
Given a position in
termDescriptions , this method computes all
term strings that had that description in each of the sub-indexes of the
federated index that produced this result set. |
String[][] |
getSubIndexTerms(String termString)
Tries to locate the correct term position and calls
getSubIndexTerms(int) . |
static TermsResultSet |
groupByDescription(TermsResultSet... resSets)
This method re-arranges the data included in one or more
TermsResultSet values so that each term description occurs only
once in the termDescriptions array. |
static void |
sortTermsResultSetByTermString(TermsResultSet trs)
Sorts the arrays inside a
TermsResultSet using the termString for
comparison. |
public final int[] termLengths
termStrings
, and termDescriptions
.public final String[] termStrings
termCounts
and termDescriptions
.public String[][][] originalTermStrings
groupByDescription(TermsResultSet...)
method. It contains term
strings from the original result sets indexed by position in this result
set, and the index of the results set. For example
originalTermStrings[i][j] is a String[], containing all the term strings
associated with termDescriptions[i] in the jth result set.public final String[] termDescriptions
SemanticAnnotationHelper
that was used to index the
annotations. These URIs are not useful outside of the annotation helper
and index, so term descriptions can be requested. If term descriptions were
produced during the search, they are stored in this array (which is aligned
with #termIds
and termCounts
).public final int[] termCounts
termStrings
and #termIds
.public static final TermsResultSet EMPTY
public String[][] getSubIndexTerms(int termPosition)
termDescriptions
, this method computes all
term strings that had that description in each of the sub-indexes of the
federated index that produced this result set.termPosition
- the term for which the original term strings are being
requested.public String[][] getSubIndexTerms(String termString)
getSubIndexTerms(int)
.termString
- public static void sortTermsResultSetByTermString(TermsResultSet trs)
TermsResultSet
using the termString for
comparison.trs
- public static TermsResultSet filterByDescriptionNot(TermsResultSet setToFilter, String... bannedDescriptions)
bannedDescriptions
- A String array containing all the banned term
descriptions.setToFilter
- the terms result set to filterpublic static TermsResultSet groupByDescription(TermsResultSet... resSets)
TermsResultSet
values so that each term description occurs only
once in the termDescriptions
array.
A TermsResultSet
obtained when calling
TermsQuery.execute(gate.mimir.search.QueryEngine)
may include the
same description for multiple term strings: depending on the implementation
used to describe terms, distinct terms may end up with the same
description. This could cause confusion when the output is presented to
the user, as they would have no way to distinguish between the different
terms.
When executing a terms query against a federated index, each sub-index
returns its own result set. Terms originating in different sub-indexes can
have the same description.
This method combines these into a unified result set that preserves the
right term ID to term description mappings by populating the
originalTermStrings
array.resSets
- the result sets produced by the sub-indexes of a federated
index.Copyright © 2021 GATE. All rights reserved.