Package org.appng.search.searcher
Class StandardSearcher
- java.lang.Object
-
- org.appng.search.searcher.StandardSearcher
-
- All Implemented Interfaces:
SearchProvider
public class StandardSearcher extends Object implements SearchProvider
-
-
Field Summary
-
Fields inherited from interface org.appng.search.SearchProvider
MAX_HITS
-
-
Constructor Summary
Constructors Constructor Description StandardSearcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<Document>doSearch(Environment env, Site site, Application application, org.apache.lucene.store.Directory directory, String term, String language, String[] parseFields, org.apache.lucene.analysis.Analyzer analyzer, String highlightWith, Map<String,String> parameters)Performs the actual searchprotected org.apache.lucene.search.QuerygetQuery(String[] parseFields, String searchTerm, org.apache.lucene.analysis.Analyzer analyzer, String language, String[] excludeTypes)StringgetSearchTerm(String searchTerm, String searchTermTransform)
-
-
-
Method Detail
-
doSearch
public Iterable<Document> doSearch(Environment env, Site site, Application application, org.apache.lucene.store.Directory directory, String term, String language, String[] parseFields, org.apache.lucene.analysis.Analyzer analyzer, String highlightWith, Map<String,String> parameters) throws IOException
Description copied from interface:SearchProviderPerforms the actual search- Specified by:
doSearchin interfaceSearchProvider- Parameters:
env- the currentEnvironmentsite- the currentSiteapplication- the currentApplicationdirectory- theDirectoryrepresenting the currentSite's Lucene index.
Note that it only makes sense to use this directory for searching if theApplicationalso contributes someDocuments to theSite's global index by usingFeatureProvider.getIndexer()or implementingDocumentProvider. Otherwise, theApplicationmight have it's own Lucene index or even get theDocuments from somewhere else (for example from the database or filesystem).term- the search termlanguage- the language for the searchparseFields- the fields to searchanalyzer- theAnalyzerto usehighlightWith- a tagname to highlight fragments with, e.gspanordivparameters- some custom parameters for this search- Returns:
- an
Iterable<Document> containing the foundDocuments - Throws:
IOException- if an error occurs while searching
-
getQuery
protected org.apache.lucene.search.Query getQuery(String[] parseFields, String searchTerm, org.apache.lucene.analysis.Analyzer analyzer, String language, String[] excludeTypes) throws org.apache.lucene.queryparser.classic.ParseException
- Throws:
org.apache.lucene.queryparser.classic.ParseException
-
-