Class SearchQuery
- java.lang.Object
-
- lumis.portal.bigdata.query.SearchQuery
-
@StableMinor(version="14.2", sinceVersion="9.0") public class SearchQuery extends Object
Represents search criteria used to find matching information by asearcher
.- Since:
- 8.1.0
- Version:
- $Revision: 24985 $ $Date: 2022-05-02 23:04:30 -0300 (Mon, 02 May 2022) $
- See Also:
IBigDataSearcher
-
-
Constructor Summary
Constructors Constructor Description SearchQuery()
SearchQuery(String query)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SearchQuery
addAggregation(IAggregation aggregation)
Adds the given aggregation in this search query.SearchQuery
addAggregations(List<IAggregation> aggregations)
Adds the given aggregations in this search query.SearchQuery
addAggregations(IAggregation... aggregations)
Adds the given aggregations in this search query.SearchQuery
addDocumentTypeIds(String... documentTypes)
Adds the given document types to the scope for this search query.SearchQuery
addDocumentTypeIds(Collection<String> documentTypeIds)
Adds the given document types to the scope for this search query.SearchQuery
addDocumentTypes(Collection<? extends DocumentType> documentTypes)
Adds the given document types to the scope for this search query.SearchQuery
addDocumentTypes(DocumentType... documentTypes)
Adds the given document types to the scope for this search query.SearchQuery
addFieldBoost(String fieldId, float boost)
Adds a field boost to search.SearchQuery
addFieldBoost(DocumentTypeField documentTypeField, float boost)
Adds a field boost to search.SearchQuery
addSort(ISearchQuerySort sort)
Adds a sort definition in this search.List<IAggregation>
getAggregations()
Returns an unmodifiable list of the added aggregations.ISearchQueryFilter
getControlFilter()
Returns a query filter to be applied to the search.Set<String>
getDocumentTypeIds()
Returns the identifiers of document types set as the scope for this search query.Map<DocumentTypeField,Float>
getFieldsBoost()
Returns the field boosting configuration.HighlightConfig
getHighlight()
Returns the highlight configuration.int
getMaxRows()
List<ISearchQuerySort>
getSorts()
Returns an unmodifiable list of added sorts.int
getStartAt()
String
getUserQuery()
Returns the user query, which is the user-defined portion of thequery
, usually entered by the final user using front-end interfaces.SearchQuery
setControlFilter(ISearchQueryFilter controlFilter)
Sets the query filter to be applied to the search.SearchQuery
setHighlight(HighlightConfig highlight)
Sets the highlight configuration.SearchQuery
setMaxRows(int maxRows)
Sets themaximum number of hits
.SearchQuery
setStartAt(int startAt)
Sets thenumber of the first hit
.
This number is 1-based (the first result is the result number 1).SearchQuery
setUserQuery(String query)
Sets theuser query
.
-
-
-
Constructor Detail
-
SearchQuery
public SearchQuery()
- Since:
- 8.1.0
-
SearchQuery
public SearchQuery(String query)
- Parameters:
query
-user query
- Since:
- 8.1.0
-
-
Method Detail
-
getUserQuery
public String getUserQuery()
Returns the user query, which is the user-defined portion of thequery
, usually entered by the final user using front-end interfaces.The
searcher
can and usually perform a tokenization in the user query in the same way they do in thecontents
during the indexing process.- Returns:
- the user query
- Since:
- 8.1.0
-
setUserQuery
public SearchQuery setUserQuery(String query)
Sets theuser query
.- Parameters:
query
- theuser query
. If the given user query is a blank string ornull
, it is equivalent to not having an user query.- Since:
- 8.1.0
-
getMaxRows
public int getMaxRows()
Returns the maximum number ofhits
to be returned by thequery
execution
.Usually this setting is used to paginate the
search results
.- Returns:
- the maximum number of hits
- Since:
- 8.1.0
-
setMaxRows
public SearchQuery setMaxRows(int maxRows)
Sets themaximum number of hits
.- Parameters:
maxRows
- the maximum number of hits- Since:
- 8.1.0
-
getStartAt
public int getStartAt()
Returns the number of the firsthit
to be returned by thequery
execution
.Usually this setting is used to paginate the
search results
.
This number is 1-based (the first result is the result number 1).- Returns:
- the number of the first
hit
- Since:
- 8.1.0
-
setStartAt
public SearchQuery setStartAt(int startAt)
Sets thenumber of the first hit
.
This number is 1-based (the first result is the result number 1).- Parameters:
startAt
- thenumber of the first hit
- Since:
- 8.1.0
-
getControlFilter
public ISearchQueryFilter getControlFilter()
Returns a query filter to be applied to the search.- Returns:
- the query filter, or
null
if none was specified. - Since:
- 8.1.0
- See Also:
#getControlQuery()
-
setControlFilter
public SearchQuery setControlFilter(ISearchQueryFilter controlFilter)
Sets the query filter to be applied to the search.- Parameters:
the
- query filter.- Since:
- 8.1.0
- See Also:
#setControlQuery(String)
-
addSort
public SearchQuery addSort(ISearchQuerySort sort)
Adds a sort definition in this search.- Parameters:
sort
- the sort definition.- Since:
- 8.1.0
-
getSorts
public List<ISearchQuerySort> getSorts()
Returns an unmodifiable list of added sorts.- Returns:
- an unmodifiable list of added sorts.
- Since:
- 8.1.0
-
setHighlight
public SearchQuery setHighlight(HighlightConfig highlight)
Sets the highlight configuration.- Parameters:
highlight
- the highlight configuration.- Returns:
- this search query.
- Since:
- 8.1.0
-
getHighlight
public HighlightConfig getHighlight()
Returns the highlight configuration.- Returns:
- the highlight configuration.
- Since:
- 8.1.0
-
addAggregation
public SearchQuery addAggregation(IAggregation aggregation)
Adds the given aggregation in this search query. Returns this search query.- Parameters:
aggregation
- the aggregation.- Returns:
- this search query.
- Since:
- 9.0.0
-
addAggregations
public SearchQuery addAggregations(IAggregation... aggregations)
Adds the given aggregations in this search query. Returns this search query.- Parameters:
aggregations
- the aggregations.- Returns:
- this search query.
- Since:
- 9.0.0
-
addAggregations
public SearchQuery addAggregations(List<IAggregation> aggregations)
Adds the given aggregations in this search query. Returns this search query.- Parameters:
aggregations
- the aggregations.- Returns:
- this search query.
- Since:
- 9.0.0
-
getAggregations
public List<IAggregation> getAggregations()
Returns an unmodifiable list of the added aggregations.- Returns:
- an unmodifiable list of the added aggregations.
- Since:
- 9.0.0
-
addFieldBoost
public SearchQuery addFieldBoost(String fieldId, float boost) throws PortalObjectNotFoundException
Adds a field boost to search. This configuration is only used whena user query
is present in search query.- Parameters:
fieldId
- the identifier of the field to be boosted.boost
- the boost value.- Returns:
- this search query.
- Throws:
PortalObjectNotFoundException
- if no field with the given identifier could be found.- Since:
- 11.1.0
-
addFieldBoost
public SearchQuery addFieldBoost(DocumentTypeField documentTypeField, float boost)
Adds a field boost to search. This configuration is only used whena user query
is present in search query.- Parameters:
documentTypeField
- the field to be boosted.boost
- the boost value.- Returns:
- this search query.
- Throws:
PortalObjectNotFoundException
- if no field with the given identifier could be found.IllegalArgumentException
- if the field is not indexed.IllegalArgumentException
- if the boost value is not positive.- Since:
- 11.1.0
- See Also:
DocumentTypeField.getIndexMode()
-
addDocumentTypes
public SearchQuery addDocumentTypes(DocumentType... documentTypes)
Adds the given document types to the scope for this search query.By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
- Parameters:
documentTypes
- the document types to add.- Returns:
- this search query for chaining operation.
- Since:
- 12.5.0
-
addDocumentTypes
public SearchQuery addDocumentTypes(Collection<? extends DocumentType> documentTypes)
Adds the given document types to the scope for this search query.By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
- Parameters:
documentTypes
- the document types to add.- Returns:
- this search query for chaining operation.
- Since:
- 12.5.0
-
addDocumentTypeIds
public SearchQuery addDocumentTypeIds(String... documentTypes)
Adds the given document types to the scope for this search query.By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
- Parameters:
documentTypeIds
- the identifiers of document types to add.- Returns:
- this search query for chaining operation.
- Since:
- 12.5.0
-
addDocumentTypeIds
public SearchQuery addDocumentTypeIds(Collection<String> documentTypeIds)
Adds the given document types to the scope for this search query.By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
- Parameters:
documentTypeIds
- the identifiers of document types to add.- Returns:
- this search query for chaining operation.
- Since:
- 12.5.0
-
getDocumentTypeIds
public Set<String> getDocumentTypeIds()
Returns the identifiers of document types set as the scope for this search query.- Returns:
- a unmodifiable set with the document type identifiers. If no document type was set as the scope for this search query then an empty set is returned.
- Since:
- 12.5.0
-
getFieldsBoost
public Map<DocumentTypeField,Float> getFieldsBoost()
Returns the field boosting configuration.- Returns:
- the field boosting configuration.
- Since:
- 11.1.0
-
-