org.gcube.indexmanagement.lucenewrapper
Class HighlighterWrapper
java.lang.Object
org.gcube.indexmanagement.lucenewrapper.HighlighterWrapper
public class HighlighterWrapper
- extends Object
A wrapper for the highlight functionality of lucene . See Highlighter javadoc Note: we use the version 2.4.1, not the 2.9.1 that
is referring to the above link
- Since:
- 12-23-2011
- Version:
- 1.1
- Author:
- Alexandros Antoniadis
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HighlighterWrapper
public HighlighterWrapper(org.apache.lucene.index.IndexReader indexReader)
getSnippetSize
public Integer getSnippetSize()
setSnippetSize
public void setSnippetSize(Integer snippetSize)
getMaximumSnippetsCount
public Integer getMaximumSnippetsCount()
setMaximumSnippetsCount
public void setMaximumSnippetsCount(Integer maximumSnippetsCount)
getIndexReader
public org.apache.lucene.index.IndexReader getIndexReader()
setIndexReader
public void setIndexReader(org.apache.lucene.index.IndexReader indexReader)
getDocSnippets
public List<String> getDocSnippets(org.apache.lucene.document.Document doc,
HashMap<String,ArrayList<String>> queryMap)
throws Exception
- Highlights chosen terms of fields in a document, extracting the most
relevant sections
- Parameters:
doc - the document that will be highlightedqueryMap - a mapping of all the fields and the attributes
- Returns:
- a list of highlighted text fragment or
null if no
terms found
- Throws:
Exception
getSnippetString
public static String getSnippetString(List<String> snippets)
- Transforms a list of snippets into a formatted string
- Parameters:
snippets - The list of the snippets
- Returns:
- a string that contains all the snippets concatenated
Copyright © 2012. All Rights Reserved.