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.Query
getQuery(String[] parseFields, String searchTerm, org.apache.lucene.analysis.Analyzer analyzer, String language, String[] excludeTypes)
String
getSearchTerm(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:SearchProvider
Performs the actual search- Specified by:
doSearch
in interfaceSearchProvider
- Parameters:
env
- the currentEnvironment
site
- the currentSite
application
- the currentApplication
directory
- theDirectory
representing the currentSite
's Lucene index.
Note that it only makes sense to use this directory for searching if theApplication
also contributes someDocument
s to theSite
's global index by usingFeatureProvider.getIndexer()
or implementingDocumentProvider
. Otherwise, theApplication
might have it's own Lucene index or even get theDocument
s from somewhere else (for example from the database or filesystem).term
- the search termlanguage
- the language for the searchparseFields
- the fields to searchanalyzer
- theAnalyzer
to usehighlightWith
- a tagname to highlight fragments with, e.gspan
ordiv
parameters
- some custom parameters for this search- Returns:
- an
Iterable
<Document
> containing the foundDocument
s - 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
-
-