public class LuceneSearchProvider extends Object implements SearchProvider
Constructor and Description |
---|
LuceneSearchProvider(SearchProviderFactory searchProviderFactory,
PermissionsFilterGenerator permissionsFilterGenerator,
SearchHandlerManager searchHandlerManager,
SearchSortUtil searchSortUtil,
LuceneQueryBuilder luceneQueryBuilder,
JqlAliasManager jqlAliasManager,
FeatureManager featureManager,
com.atlassian.event.api.EventPublisher eventPublisher,
PermissionQueryCache permissionQueryCache,
ApplicationProperties applicationProperties,
ProjectManager projectManager,
PluginIndexConfigurationManager pluginIndexConfigurationManager) |
Modifier and Type | Method and Description |
---|---|
long |
getHitCount(SearchQuery query)
Return the number of documents that match the
query |
void |
search(SearchQuery query,
org.apache.lucene.search.Collector collector)
Run a search against the Issue index with the
collector called for each document that matches the query . |
SearchResults<DocumentWithId> |
search(SearchQuery query,
PagerFilter pager)
Run a search against the Issue index, loading all fields for each document.
|
SearchResults<DocumentWithId> |
search(SearchQuery query,
PagerFilter pager,
Set<String> fieldsToLoad)
Run a search against the Issue index, loading only a restricted subset of fields for each document.
|
public LuceneSearchProvider(SearchProviderFactory searchProviderFactory, PermissionsFilterGenerator permissionsFilterGenerator, SearchHandlerManager searchHandlerManager, SearchSortUtil searchSortUtil, LuceneQueryBuilder luceneQueryBuilder, JqlAliasManager jqlAliasManager, FeatureManager featureManager, com.atlassian.event.api.EventPublisher eventPublisher, PermissionQueryCache permissionQueryCache, ApplicationProperties applicationProperties, ProjectManager projectManager, PluginIndexConfigurationManager pluginIndexConfigurationManager)
public SearchResults<DocumentWithId> search(SearchQuery query, PagerFilter pager, Set<String> fieldsToLoad) throws SearchException
SearchProvider
Query.getOrderByClause()
and Lucene scoring.search
in interface SearchProvider
query
- Query to define which Lucene documents should be returned.pager
- PagerFilter to restrict the portion of documents matching the query
that will be returned.fieldsToLoad
- Set of fields that should be loaded. Only these fields will be available in the returned
document
.
Empty set means only document id
will be loaded.SearchResults
with Lucene documents (and their internal ids) with only specific fields loadedSearchException
DocumentWithId
public SearchResults<DocumentWithId> search(SearchQuery query, PagerFilter pager) throws SearchException
SearchProvider
SearchProvider.search(SearchQuery, PagerFilter, Set)
, loading only a subset of fields.
Query.getOrderByClause()
and Lucene scoring.search
in interface SearchProvider
query
- Query to define which Lucene documents should be returned.pager
- PagerFilter to restrict the portion of documents matching the query
that will be returned.SearchResults
with Lucene documents (and their internal ids) with all fields loadedSearchException
DocumentWithId
public long getHitCount(SearchQuery query) throws SearchException
SearchProvider
query
getHitCount
in interface SearchProvider
query
- Query to define which Lucene documents should be counted.SearchException
public void search(SearchQuery query, org.apache.lucene.search.Collector collector) throws SearchException
SearchProvider
collector
called for each document that matches the query
.
Query.getOrderByClause()
.
The collector
will be called according to Lucene's internal index structure.
The docIds passed to LeafCollector.collect(int)
are in order that is safe
to be used with DocValuesIterator.advanceExact(int)
method.
SearchProvider.search(SearchQuery, PagerFilter)
and
SearchProvider.search(SearchQuery, PagerFilter, Set)
, it does not load all returned documents into the memory at once.
For each result it calls LeafCollector.collect(int)
with the document id and leaves it up to the Collector
implementation
to decide what to do: load all or only specific fields, save just the document id, or ignore the given id completely.search
in interface SearchProvider
SearchException
Copyright © 2002-2019 Atlassian. All Rights Reserved.