mirror of https://github.com/apache/lucene.git
remove empty "@return" tags so javadoc stops complaining; small whitespace cleanup
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@154083 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
45864d1c9c
commit
335c1567d8
|
@ -25,7 +25,6 @@ public interface Encoder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param originalText The section of text being output
|
* @param originalText The section of text being output
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
String encodeText(String originalText);
|
String encodeText(String originalText);
|
||||||
}
|
}
|
|
@ -27,7 +27,6 @@ public interface Formatter
|
||||||
* @param originalText The section of text being considered for markup
|
* @param originalText The section of text being considered for markup
|
||||||
* @param tokenGroup contains one or several overlapping Tokens along with
|
* @param tokenGroup contains one or several overlapping Tokens along with
|
||||||
* their scores and positions.
|
* their scores and positions.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
String highlightTerm(String originalText, TokenGroup tokenGroup);
|
String highlightTerm(String originalText, TokenGroup tokenGroup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ public interface Fragmenter
|
||||||
/**
|
/**
|
||||||
* Test to see if this token from the stream should be held in a new TextFragment
|
* Test to see if this token from the stream should be held in a new TextFragment
|
||||||
* @param nextToken
|
* @param nextToken
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public boolean isNewFragment(Token nextToken);
|
public boolean isNewFragment(Token nextToken);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,6 @@ public class Highlighter
|
||||||
* @param text
|
* @param text
|
||||||
* @param maxNumFragments
|
* @param maxNumFragments
|
||||||
* @param mergeContiguousFragments
|
* @param mergeContiguousFragments
|
||||||
* @return
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public final TextFragment[] getBestTextFragments(
|
public final TextFragment[] getBestTextFragments(
|
||||||
|
@ -411,7 +410,6 @@ public class Highlighter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public Fragmenter getTextFragmenter()
|
public Fragmenter getTextFragmenter()
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class TokenGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return all tokens' scores summed up
|
||||||
*/
|
*/
|
||||||
public float getTotalScore()
|
public float getTotalScore()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,51 +1,57 @@
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
The highlight package contains classes to provide "keyword in context" features
|
The highlight package contains classes to provide "keyword in context" features
|
||||||
typically used to highlight search terms in the text of results pages. <br>
|
typically used to highlight search terms in the text of results pages.
|
||||||
The Highlighter class is the central component and can be used to extract the
|
The Highlighter class is the central component and can be used to extract the
|
||||||
most interesting sections of a piece of text and highlight them, with the help of
|
most interesting sections of a piece of text and highlight them, with the help of
|
||||||
Fragmenter, FragmentScorer, Formatter classes.
|
Fragmenter, FragmentScorer, Formatter classes.
|
||||||
|
|
||||||
<h2>Example Usage</h2>
|
<h2>Example Usage</h2>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
IndexSearcher searcher = new IndexSearcher(ramDir);
|
IndexSearcher searcher = new IndexSearcher(ramDir);
|
||||||
Query query = QueryParser.parse("Kenne*", FIELD_NAME, analyzer);
|
Query query = QueryParser.parse("Kenne*", FIELD_NAME, analyzer);
|
||||||
query=query.rewrite(reader); //required to expand search terms
|
query = query.rewrite(reader); //required to expand search terms
|
||||||
Hits hits = searcher.search(query);
|
Hits hits = searcher.search(query);
|
||||||
|
|
||||||
Highlighter highlighter =new Highlighter(this,new QueryScorer(query));
|
Highlighter highlighter = new Highlighter(this, new QueryScorer(query));
|
||||||
for (int i = 0; i < hits.length(); i++)
|
for (int i = 0; i < hits.length(); i++)
|
||||||
{
|
{
|
||||||
String text = hits.doc(i).get(FIELD_NAME);
|
String text = hits.doc(i).get(FIELD_NAME);
|
||||||
TokenStream tokenStream=analyzer.tokenStream(FIELD_NAME,new StringReader(text));
|
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
|
||||||
// Get 3 best fragments and seperate with a "..."
|
// Get 3 best fragments and seperate with a "..."
|
||||||
String result = highlighter.getBestFragments(tokenStream,text,3,"...");
|
String result = highlighter.getBestFragments(tokenStream, text, 3, "...");
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2>New features 06/02/2005</h2>
|
<h2>New features 06/02/2005</h2>
|
||||||
|
|
||||||
This release adds options for encoding (thanks to Nicko Cadell).
|
This release adds options for encoding (thanks to Nicko Cadell).
|
||||||
An "Encoder" implementation such as the new SimpleHTMLEncoder class can be passed to the highlighter to encode
|
An "Encoder" implementation such as the new SimpleHTMLEncoder class can be passed to the highlighter to encode
|
||||||
all those non-xhtml standard characters such as & into legal values. This simple class may not suffice for
|
all those non-xhtml standard characters such as & into legal values. This simple class may not suffice for
|
||||||
some languages - Commons Lang has an implementation that could be used: escapeHtml(String) in
|
some languages - Commons Lang has an implementation that could be used: escapeHtml(String) in
|
||||||
http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java?rev=137958&view=markup
|
http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java?rev=137958&view=markup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2>New features 22/12/2004</h2>
|
<h2>New features 22/12/2004</h2>
|
||||||
|
|
||||||
This release adds some new capabilities:
|
This release adds some new capabilities:
|
||||||
<ol>
|
<ol>
|
||||||
<li>Faster highlighting using Term vector support</li>
|
<li>Faster highlighting using Term vector support</li>
|
||||||
<li>New formatting options to use color intensity to show informational value</li>
|
<li>New formatting options to use color intensity to show informational value</li>
|
||||||
<li>Options for better summarization by using term IDF scores to influence fragment selection</li>
|
<li>Options for better summarization by using term IDF scores to influence fragment selection</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The highlighter takes a TokenStream as input. Until now these streams have typically been produced
|
The highlighter takes a TokenStream as input. Until now these streams have typically been produced
|
||||||
using an Analyzer but the new class TokenSources provides helper methods for obtaining TokenStreams from
|
using an Analyzer but the new class TokenSources provides helper methods for obtaining TokenStreams from
|
||||||
the new TermVector position support (see latest CVS version).</p>
|
the new TermVector position support (see latest CVS version).</p>
|
||||||
|
|
||||||
<p>The new class GradientFormatter can use a scale of colors to highlight terms according to their score.
|
<p>The new class GradientFormatter can use a scale of colors to highlight terms according to their score.
|
||||||
A subtle use of color can help emphasise the reasons for matching (useful when doing "MoreLikeThis" queries and
|
A subtle use of color can help emphasise the reasons for matching (useful when doing "MoreLikeThis" queries and
|
||||||
you want to see what the basis of the similarities are)</p>
|
you want to see what the basis of the similarities are).</p>
|
||||||
|
|
||||||
<p>The QueryScorer class has a new constructor which can use an IndexReader to derive the IDF (inverse document frequency)
|
<p>The QueryScorer class has a new constructor which can use an IndexReader to derive the IDF (inverse document frequency)
|
||||||
for each term in order to influcence the score. This is useful for helping to extracting the most significant sections
|
for each term in order to influcence the score. This is useful for helping to extracting the most significant sections
|
||||||
of a document and in supplying scores used by the new GradientFormatter to color significant words more strongly.
|
of a document and in supplying scores used by the new GradientFormatter to color significant words more strongly.
|
||||||
|
|
Loading…
Reference in New Issue