org.apache.maven.index
Class DefaultSearchEngine

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.index.DefaultSearchEngine
All Implemented Interfaces:
SearchEngine, org.codehaus.plexus.logging.LogEnabled

@Component(role=SearchEngine.class)
public class DefaultSearchEngine
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements SearchEngine

A default search engine implementation

Author:
Eugene Kuleshov, Tamas Cservenak

Constructor Summary
DefaultSearchEngine()
           
 
Method Summary
protected  org.apache.lucene.search.TopScoreDocCollector doSearchWithCeiling(AbstractSearchRequest request, org.apache.lucene.search.IndexSearcher indexSearcher, org.apache.lucene.search.Query query)
           
 FlatSearchResponse forceSearchFlatPaged(FlatSearchRequest request, Collection<IndexingContext> indexingContexts)
          Do the search in all contexts, no matter if the context is searchable or not
 GroupedSearchResponse forceSearchGrouped(GroupedSearchRequest request, Collection<IndexingContext> indexingContexts)
          Do the search in all contexts, no matter if the context is searchable or not
 IteratorSearchResponse forceSearchIteratorPaged(IteratorSearchRequest request, Collection<IndexingContext> indexingContexts)
          Do the search in all contexts, no matter if the context is searchable or not
protected  org.apache.lucene.index.IndexReader getMergedIndexReader(Collection<IndexingContext> indexingContexts, boolean ignoreContext)
          Locks down participating contexts, and returns a "merged" reader of them.
protected  List<IndexingContext> getParticipatingContexts(Collection<IndexingContext> indexingContexts, boolean ignoreContext)
          Returns the list of participating contexts.
protected  int getTopDocsCollectorHitNum(AbstractSearchRequest request, int ceiling)
           
 Set<ArtifactInfo> searchFlat(Comparator<ArtifactInfo> artifactInfoComparator, Collection<IndexingContext> indexingContexts, org.apache.lucene.search.Query query)
          Deprecated. 
 Set<ArtifactInfo> searchFlat(Comparator<ArtifactInfo> artifactInfoComparator, IndexingContext indexingContext, org.apache.lucene.search.Query query)
          Deprecated. 
protected  int searchFlat(FlatSearchRequest req, Collection<ArtifactInfo> result, List<IndexingContext> participatingContexts, org.apache.lucene.search.Query query)
           
 FlatSearchResponse searchFlatPaged(FlatSearchRequest request, Collection<IndexingContext> indexingContexts)
          Do the search only on searchable contexts
protected  FlatSearchResponse searchFlatPaged(FlatSearchRequest request, Collection<IndexingContext> indexingContexts, boolean ignoreContext)
           
 GroupedSearchResponse searchGrouped(GroupedSearchRequest request, Collection<IndexingContext> indexingContexts)
          Do the search only on searchable contexts
protected  GroupedSearchResponse searchGrouped(GroupedSearchRequest request, Collection<IndexingContext> indexingContexts, boolean ignoreContext)
           
protected  int searchGrouped(GroupedSearchRequest req, Map<String,ArtifactInfoGroup> result, Grouping grouping, List<IndexingContext> participatingContexts, org.apache.lucene.search.Query query)
           
 IteratorSearchResponse searchIteratorPaged(IteratorSearchRequest request, Collection<IndexingContext> indexingContexts)
          Do the search only on searchable contexts
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSearchEngine

public DefaultSearchEngine()
Method Detail

searchFlat

@Deprecated
public Set<ArtifactInfo> searchFlat(Comparator<ArtifactInfo> artifactInfoComparator,
                                               IndexingContext indexingContext,
                                               org.apache.lucene.search.Query query)
                             throws IOException
Deprecated. 

Specified by:
searchFlat in interface SearchEngine
Throws:
IOException

searchFlat

@Deprecated
public Set<ArtifactInfo> searchFlat(Comparator<ArtifactInfo> artifactInfoComparator,
                                               Collection<IndexingContext> indexingContexts,
                                               org.apache.lucene.search.Query query)
                             throws IOException
Deprecated. 

Specified by:
searchFlat in interface SearchEngine
Throws:
IOException

searchFlatPaged

public FlatSearchResponse searchFlatPaged(FlatSearchRequest request,
                                          Collection<IndexingContext> indexingContexts)
                                   throws IOException
Description copied from interface: SearchEngine
Do the search only on searchable contexts

Specified by:
searchFlatPaged in interface SearchEngine
Throws:
IOException

forceSearchFlatPaged

public FlatSearchResponse forceSearchFlatPaged(FlatSearchRequest request,
                                               Collection<IndexingContext> indexingContexts)
                                        throws IOException
Description copied from interface: SearchEngine
Do the search in all contexts, no matter if the context is searchable or not

Specified by:
forceSearchFlatPaged in interface SearchEngine
Throws:
IOException

searchFlatPaged

protected FlatSearchResponse searchFlatPaged(FlatSearchRequest request,
                                             Collection<IndexingContext> indexingContexts,
                                             boolean ignoreContext)
                                      throws IOException
Throws:
IOException

searchGrouped

public GroupedSearchResponse searchGrouped(GroupedSearchRequest request,
                                           Collection<IndexingContext> indexingContexts)
                                    throws IOException
Description copied from interface: SearchEngine
Do the search only on searchable contexts

Specified by:
searchGrouped in interface SearchEngine
Throws:
IOException

forceSearchGrouped

public GroupedSearchResponse forceSearchGrouped(GroupedSearchRequest request,
                                                Collection<IndexingContext> indexingContexts)
                                         throws IOException
Description copied from interface: SearchEngine
Do the search in all contexts, no matter if the context is searchable or not

Specified by:
forceSearchGrouped in interface SearchEngine
Throws:
IOException

searchGrouped

protected GroupedSearchResponse searchGrouped(GroupedSearchRequest request,
                                              Collection<IndexingContext> indexingContexts,
                                              boolean ignoreContext)
                                       throws IOException
Throws:
IOException

searchFlat

protected int searchFlat(FlatSearchRequest req,
                         Collection<ArtifactInfo> result,
                         List<IndexingContext> participatingContexts,
                         org.apache.lucene.search.Query query)
                  throws IOException
Throws:
IOException

searchGrouped

protected int searchGrouped(GroupedSearchRequest req,
                            Map<String,ArtifactInfoGroup> result,
                            Grouping grouping,
                            List<IndexingContext> participatingContexts,
                            org.apache.lucene.search.Query query)
                     throws IOException
Throws:
IOException

searchIteratorPaged

public IteratorSearchResponse searchIteratorPaged(IteratorSearchRequest request,
                                                  Collection<IndexingContext> indexingContexts)
                                           throws IOException
Description copied from interface: SearchEngine
Do the search only on searchable contexts

Specified by:
searchIteratorPaged in interface SearchEngine
Throws:
IOException

forceSearchIteratorPaged

public IteratorSearchResponse forceSearchIteratorPaged(IteratorSearchRequest request,
                                                       Collection<IndexingContext> indexingContexts)
                                                throws IOException
Description copied from interface: SearchEngine
Do the search in all contexts, no matter if the context is searchable or not

Specified by:
forceSearchIteratorPaged in interface SearchEngine
Throws:
IOException

doSearchWithCeiling

protected org.apache.lucene.search.TopScoreDocCollector doSearchWithCeiling(AbstractSearchRequest request,
                                                                            org.apache.lucene.search.IndexSearcher indexSearcher,
                                                                            org.apache.lucene.search.Query query)
                                                                     throws IOException
Throws:
IOException

getParticipatingContexts

protected List<IndexingContext> getParticipatingContexts(Collection<IndexingContext> indexingContexts,
                                                         boolean ignoreContext)
Returns the list of participating contexts. Does not locks them, just builds a list of them.


getMergedIndexReader

protected org.apache.lucene.index.IndexReader getMergedIndexReader(Collection<IndexingContext> indexingContexts,
                                                                   boolean ignoreContext)
                                                            throws IOException
Locks down participating contexts, and returns a "merged" reader of them. In case of error, unlocks as part of cleanup and re-throws exception. Without error, it is the duty of caller to unlock contexts!

Parameters:
indexingContexts -
ignoreContext -
Returns:
Throws:
IOException

getTopDocsCollectorHitNum

protected int getTopDocsCollectorHitNum(AbstractSearchRequest request,
                                        int ceiling)


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.