⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 similarity.html

📁  Lucene是apache软件基金会[4] jakarta项目组的一个子项目
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<PRE>
public abstract float <B>lengthNorm</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;fieldName,                                 int&nbsp;numTokens)</PRE>
<DL>
<DD>Computes the normalization value for a field given the total number of terms contained in a field.  These values, together with field boosts, are stored in an index and multipled into scores for hits on each field by the search code. <p>Matches in longer fields are less precise, so implementations of this method usually return smaller values when <code>numTokens</code> is large, and larger values when <code>numTokens</code> is small. <p>That these values are computed under <CODE>IndexWriter#addDocument(org.apache.lucene.document.Document)</CODE> and stored then using <A HREF="../../../../org/apache/lucene/search/Similarity.html#encodeNorm(float)"><CODE>encodeNorm(float)</CODE></A>.  Thus they have limited precision, and documents must be re-indexed if this method is altered.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>fieldName</CODE> - the name of the field<DD><CODE>numTokens</CODE> - the total number of tokens contained in fields named <i>fieldName</i> of <i>doc</i>.<DT><B>Returns:</B><DD>a normalization factor for hits on this field of this document<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/document/AbstractField.html#setBoost(float)"><CODE>AbstractField.setBoost(float)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="queryNorm(float)"><!-- --></A><H3>
queryNorm</H3>
<PRE>
public abstract float <B>queryNorm</B>(float&nbsp;sumOfSquaredWeights)</PRE>
<DL>
<DD>Computes the normalization value for a query given the sum of the squared weights of each of the query terms.  This value is then multipled into the weight of each query term. <p>This does not affect ranking, but rather just attempts to make scores from different queries comparable.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sumOfSquaredWeights</CODE> - the sum of the squares of query term weights<DT><B>Returns:</B><DD>a normalization factor for query weights</DL>
</DD>
</DL>
<HR>

<A NAME="encodeNorm(float)"><!-- --></A><H3>
encodeNorm</H3>
<PRE>
public static byte <B>encodeNorm</B>(float&nbsp;f)</PRE>
<DL>
<DD>Encodes a normalization factor for storage in an index. <p>The encoding uses a three-bit mantissa, a five-bit exponent, and the zero-exponent point at 15, thus representing values from around 7x10^9 to 2x10^-9 with about one significant decimal digit of accuracy.  Zero is also represented. Negative numbers are rounded up to zero.  Values too large to represent are rounded down to the largest representable value.  Positive values too small to represent are rounded up to the smallest positive representable value.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/document/AbstractField.html#setBoost(float)"><CODE>AbstractField.setBoost(float)</CODE></A>, <CODE>SmallFloat</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="tf(int)"><!-- --></A><H3>
tf</H3>
<PRE>
public float <B>tf</B>(int&nbsp;freq)</PRE>
<DL>
<DD>Computes a score factor based on a term or phrase's frequency in a document.  This value is multiplied by the <A HREF="../../../../org/apache/lucene/search/Similarity.html#idf(org.apache.lucene.index.Term, org.apache.lucene.search.Searcher)"><CODE>idf(Term, Searcher)</CODE></A> factor for each term in the query and these products are then summed to form the initial score for a document. <p>Terms and phrases repeated in a document indicate the topic of the document, so implementations of this method usually return larger values when <code>freq</code> is large, and smaller values when <code>freq</code> is small. <p>The default implementation calls <A HREF="../../../../org/apache/lucene/search/Similarity.html#tf(float)"><CODE>tf(float)</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>freq</CODE> - the frequency of a term within a document<DT><B>Returns:</B><DD>a score factor based on a term's within-document frequency</DL>
</DD>
</DL>
<HR>

<A NAME="sloppyFreq(int)"><!-- --></A><H3>
sloppyFreq</H3>
<PRE>
public abstract float <B>sloppyFreq</B>(int&nbsp;distance)</PRE>
<DL>
<DD>Computes the amount of a sloppy phrase match, based on an edit distance. This value is summed for each sloppy phrase match in a document to form the frequency that is passed to <A HREF="../../../../org/apache/lucene/search/Similarity.html#tf(float)"><CODE>tf(float)</CODE></A>. <p>A phrase match with a small edit distance to a document passage more closely matches the document, so implementations of this method usually return larger values when the edit distance is small and smaller values when it is large.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>distance</CODE> - the edit distance of this sloppy phrase match<DT><B>Returns:</B><DD>the frequency increment for this match<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/search/PhraseQuery.html#setSlop(int)"><CODE>PhraseQuery.setSlop(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="tf(float)"><!-- --></A><H3>
tf</H3>
<PRE>
public abstract float <B>tf</B>(float&nbsp;freq)</PRE>
<DL>
<DD>Computes a score factor based on a term or phrase's frequency in a document.  This value is multiplied by the <A HREF="../../../../org/apache/lucene/search/Similarity.html#idf(org.apache.lucene.index.Term, org.apache.lucene.search.Searcher)"><CODE>idf(Term, Searcher)</CODE></A> factor for each term in the query and these products are then summed to form the initial score for a document. <p>Terms and phrases repeated in a document indicate the topic of the document, so implementations of this method usually return larger values when <code>freq</code> is large, and smaller values when <code>freq</code> is small.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>freq</CODE> - the frequency of a term within a document<DT><B>Returns:</B><DD>a score factor based on a term's within-document frequency</DL>
</DD>
</DL>
<HR>

<A NAME="idf(org.apache.lucene.index.Term, org.apache.lucene.search.Searcher)"><!-- --></A><H3>
idf</H3>
<PRE>
public float <B>idf</B>(<A HREF="../../../../org/apache/lucene/index/Term.html" title="class in org.apache.lucene.index">Term</A>&nbsp;term,                 <A HREF="../../../../org/apache/lucene/search/Searcher.html" title="class in org.apache.lucene.search">Searcher</A>&nbsp;searcher)          throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Computes a score factor for a simple term. <p>The default implementation is:<pre>   return idf(searcher.docFreq(term), searcher.maxDoc()); </pre> Note that <A HREF="../../../../org/apache/lucene/search/Searcher.html#maxDoc()"><CODE>Searcher.maxDoc()</CODE></A> is used instead of <CODE>IndexReader#numDocs()</CODE> because it is proportional to <A HREF="../../../../org/apache/lucene/search/Searcher.html#docFreq(org.apache.lucene.index.Term)"><CODE>Searcher.docFreq(Term)</CODE></A> , i.e., when one is inaccurate, so is the other, and in the same direction.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>term</CODE> - the term in question<DD><CODE>searcher</CODE> - the document collection being searched<DT><B>Returns:</B><DD>a score factor for the term<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="idf(java.util.Collection, org.apache.lucene.search.Searcher)"><!-- --></A><H3>
idf</H3>
<PRE>
public float <B>idf</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A>&nbsp;terms,                 <A HREF="../../../../org/apache/lucene/search/Searcher.html" title="class in org.apache.lucene.search">Searcher</A>&nbsp;searcher)          throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Computes a score factor for a phrase. <p>The default implementation sums the <A HREF="../../../../org/apache/lucene/search/Similarity.html#idf(org.apache.lucene.index.Term, org.apache.lucene.search.Searcher)"><CODE>idf(Term,Searcher)</CODE></A> factor for each term in the phrase.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>terms</CODE> - the terms in the phrase<DD><CODE>searcher</CODE> - the document collection being searched<DT><B>Returns:</B><DD>a score factor for the phrase<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="idf(int, int)"><!-- --></A><H3>
idf</H3>
<PRE>
public abstract float <B>idf</B>(int&nbsp;docFreq,                          int&nbsp;numDocs)</PRE>
<DL>
<DD>Computes a score factor based on a term's document frequency (the number of documents which contain the term).  This value is multiplied by the <A HREF="../../../../org/apache/lucene/search/Similarity.html#tf(int)"><CODE>tf(int)</CODE></A> factor for each term in the query and these products are then summed to form the initial score for a document. <p>Terms that occur in fewer documents are better indicators of topic, so implementations of this method usually return larger values for rare terms, and smaller values for common terms.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>docFreq</CODE> - the number of documents which contain the term<DD><CODE>numDocs</CODE> - the total number of documents in the collection<DT><B>Returns:</B><DD>a score factor based on the term's document frequency</DL>
</DD>
</DL>
<HR>

<A NAME="coord(int, int)"><!-- --></A><H3>
coord</H3>
<PRE>
public abstract float <B>coord</B>(int&nbsp;overlap,                            int&nbsp;maxOverlap)</PRE>
<DL>
<DD>Computes a score factor based on the fraction of all query terms that a document contains.  This value is multiplied into scores. <p>The presence of a large portion of the query terms indicates a better match with the query, so implementations of this method usually return larger values when the ratio between these parameters is large and smaller values when the ratio between them is small.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>overlap</CODE> - the number of query terms matched in the document<DD><CODE>maxOverlap</CODE> - the total number of terms in the query<DT><B>Returns:</B><DD>a score factor based on term overlap with the query</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Similarity.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/lucene/search/Searcher.html" title="class in org.apache.lucene.search"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/lucene/search/SimilarityDelegator.html" title="class in org.apache.lucene.search"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Similarity.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright &copy; 2000-2007 Apache Software Foundation.  All Rights Reserved.
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -