|
Regain 2.1.0-STABLE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.regain.search.results.SearchResultsImpl
public class SearchResultsImpl
Holds the results of a search on a single or multiple indexes. The class uses the new Lucene API (2.9 and later).
| Field Summary | |
|---|---|
private org.apache.lucene.search.ScoreDoc[] |
hitScoreDocs
The hits of this search. |
private List |
lazyHitList
held the transformed hits. |
private org.apache.lucene.analysis.Analyzer |
mAnalyzer
The current analyzer |
private static java.util.regex.Pattern |
mimetypeFieldPattern
|
private IndexConfig |
mIndexConfig
The current config. |
private String |
mIndexName
The index name. |
private org.apache.lucene.search.IndexSearcher |
mIndexSearcher
The searcher (single or multi). |
private static org.apache.log4j.Logger |
mLog
The logger for this class |
private org.apache.lucene.index.MultiReader |
mMultiReader
The reader (multi). |
private org.apache.regexp.RE |
mOpenInNewWindowRegex
Der Reguläre Ausdruck, zu dem eine URL passen muss, damit sie in einem neuen Fenster geöffnet wird. |
private org.apache.lucene.search.BooleanQuery |
mQuery
The boolean query used while searching and highlighting |
private String |
mQueryText
The Query text. |
private int |
mSearchTime
The time the search took. |
private static java.util.regex.Pattern |
negativeMimetypeFieldPattern
|
private org.apache.lucene.search.TopDocsCollector<org.apache.lucene.search.FieldValueHitQueue.Entry> |
topDocsCollector
The DocCollector. |
| Constructor Summary | |
|---|---|
SearchResultsImpl(IndexConfig[] indexConfigs,
PageRequest request)
Creates an instanz of SearchResults. |
|
| Method Summary | |
|---|---|
private org.apache.lucene.search.BooleanQuery |
getAtomicMimeTypeQuery(String mimeTypeFieldText)
Helper method for removeMimetypeQuery |
int |
getDocumentCount()
Gets the number of documents in the in index. |
int |
getHitCount()
Gets the number of hits the search had. |
org.apache.lucene.document.Document |
getHitDocument(int index)
Gets the document of one hit. |
String |
getHitIndexName(int index)
Gets the name of the index a hit comes from. |
float |
getHitScore(int index)
Gets the score of one hit. |
String |
getHitUrl(int index)
Gets the url from a hit and rewrites it according to the rewrite rules specified in the index config. |
boolean |
getOpenHitInNewWindow(int index)
Gets whether a hit should be opened in a new window. |
String |
getQueryText()
Gets the query text of the search. |
int |
getSearchTime()
Gets the time the search took in milliseconds. |
boolean |
getShouldHighlight(int index)
Gets whether the search terms should be highlighted |
boolean |
getUseFileToHttpBridgeForHit(int index)
Gets whether the file-to-http-bridge should be used for a certain hit. |
void |
highlightHitDocument(int index)
Highlights fields in the document. |
private String |
removeMimetypeQuery(String queryText,
org.apache.lucene.search.BooleanQuery mainQuery)
Create a Query from mime type terms and remove them from the query text |
private void |
setHitDocument(int index,
org.apache.lucene.document.Document document)
Writes a changed document back to the list. |
void |
shortenSummary(int index)
Shortens the summary. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private org.apache.lucene.search.IndexSearcher mIndexSearcher
private org.apache.lucene.index.MultiReader mMultiReader
private String mQueryText
private int mSearchTime
private String mIndexName
private org.apache.lucene.search.ScoreDoc[] hitScoreDocs
private org.apache.lucene.search.TopDocsCollector<org.apache.lucene.search.FieldValueHitQueue.Entry> topDocsCollector
private static java.util.regex.Pattern mimetypeFieldPattern
private static java.util.regex.Pattern negativeMimetypeFieldPattern
private org.apache.regexp.RE mOpenInNewWindowRegex
private org.apache.lucene.search.BooleanQuery mQuery
private org.apache.lucene.analysis.Analyzer mAnalyzer
private IndexConfig mIndexConfig
private static org.apache.log4j.Logger mLog
private List lazyHitList
| Constructor Detail |
|---|
public SearchResultsImpl(IndexConfig[] indexConfigs,
PageRequest request)
throws RegainException
indexConfigs - The array of index configsrequest - The request parameters
RegainException - If searching failed.| Method Detail |
|---|
private String removeMimetypeQuery(String queryText,
org.apache.lucene.search.BooleanQuery mainQuery)
queryText - Original query textmainQuery - MIME clauses that were extracted from the query
private org.apache.lucene.search.BooleanQuery getAtomicMimeTypeQuery(String mimeTypeFieldText)
mimeTypeFieldText - The value of a mime Type
public String getQueryText()
public int getHitCount()
getHitCount in interface SearchResultspublic int getDocumentCount()
getDocumentCount in interface SearchResults
public org.apache.lucene.document.Document getHitDocument(int index)
throws RegainException
getHitDocument in interface SearchResultsindex - The index of the hit.
RegainException - If getting the document failed.Document
private void setHitDocument(int index,
org.apache.lucene.document.Document document)
throws RegainException
index - document -
RegainException
public float getHitScore(int index)
throws RegainException
getHitScore in interface SearchResultsindex - The index of the hit.
RegainException - If getting the score failed.Hits#score(int)public int getSearchTime()
getSearchTime in interface SearchResults
public boolean getOpenHitInNewWindow(int index)
throws RegainException
getOpenHitInNewWindow in interface SearchResultsindex - The index of the hit.
RegainException - If getting the URL failed.public boolean getUseFileToHttpBridgeForHit(int index)
Mozilla browsers have a security mechanism that blocks loading file-URLs from pages loaded via http. To be able to load files from the search results, regain offers the file-to-http-bridge that provides all files that are listed in the index via http.
getUseFileToHttpBridgeForHit in interface SearchResultsindex - The index of the hit.
public String getHitUrl(int index)
throws RegainException
getHitUrl in interface SearchResultsindex - The index of the hit to get the URL for.
RegainException - If getting the hit document failed.
public String getHitIndexName(int index)
throws RegainException
getHitIndexName in interface SearchResultsindex - The index of the hit to get the index name for.
RegainException - If getting the index name failed.
public void shortenSummary(int index)
throws RegainException
shortenSummary in interface SearchResultsindex - The index of the hit.
RegainException - if shorten fails.
public void highlightHitDocument(int index)
throws RegainException
highlightHitDocument in interface SearchResultsindex - The index of the hit.
RegainException - If highlighting failed.Document
public boolean getShouldHighlight(int index)
throws RegainException
getShouldHighlight in interface SearchResultsRegainException - If the value could not read from config
|
Regain 2.1.0-STABLE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||