mirror of https://github.com/apache/lucene.git
Removed some dead code and redundant javadoc. Fixed a few javadoc bugs.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150208 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60f1d192c7
commit
0aca5291dc
|
@ -35,72 +35,23 @@ class SegmentTermVector implements TermFreqVector {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toString(IndexReader ir)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
return toString();
|
|
||||||
/*StringBuffer sb = new StringBuffer();
|
|
||||||
//TODO: Reimplement
|
|
||||||
|
|
||||||
sb.append('{');
|
|
||||||
sb.append(field).append(": ");
|
|
||||||
for (int i=0; i<terms.length; i++) {
|
|
||||||
if (i>0) sb.append(", ");
|
|
||||||
Term t = ir.getTerm(terms[i]);
|
|
||||||
String text = t == null ? "UNKNOWN(" + i + ")" : t.text;
|
|
||||||
sb.append(text).append('/').append(termFreqs[i]);
|
|
||||||
if (termProx != null) appendTermProx(sb.append('/'), termProx[i]);
|
|
||||||
}
|
|
||||||
sb.append('}');
|
|
||||||
return sb.toString();*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Number of terms in the term vector. If there are no terms in the
|
|
||||||
* vector, returns 0.
|
|
||||||
*/
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return terms == null ? 0 : terms.length;
|
return terms == null ? 0 : terms.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Array of term numbers in ascending order. If there are no terms in
|
|
||||||
* the vector, returns null.
|
|
||||||
*/
|
|
||||||
public String [] getTerms() {
|
public String [] getTerms() {
|
||||||
return terms;
|
return terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Array of term frequencies. Locations of the array correspond one to one
|
|
||||||
* to the term numbers in the array obtained from <code>getTermNumbers</code>
|
|
||||||
* method. Each location in the array contains the number of times this
|
|
||||||
* term occurs in the document or the document field. If there are no terms in
|
|
||||||
* the vector, returns null.
|
|
||||||
*/
|
|
||||||
public int[] getTermFrequencies() {
|
public int[] getTermFrequencies() {
|
||||||
return termFreqs;
|
return termFreqs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Return an index in the term numbers array returned from <code>getTermNumbers</code>
|
|
||||||
* at which the term with the specified <code>termNumber</code> appears. If this
|
|
||||||
* term does not appear in the array, return -1.
|
|
||||||
*/
|
|
||||||
public int indexOf(String termText) {
|
public int indexOf(String termText) {
|
||||||
int res = Arrays.binarySearch(terms, termText);
|
int res = Arrays.binarySearch(terms, termText);
|
||||||
return res >= 0 ? res : -1;
|
return res >= 0 ? res : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Just like <code>indexOf(int)</code> but searches for a number of terms
|
|
||||||
* at the same time. Returns an array that has the same size as the number
|
|
||||||
* of terms searched for, each slot containing the result of searching for
|
|
||||||
* that term number. Array of term numbers must be sorted in ascending order.
|
|
||||||
*
|
|
||||||
* @param termNumbers array containing term numbers to look for
|
|
||||||
* @param start index in the array where the list of termNumbers starts
|
|
||||||
* @param len the number of termNumbers in the list
|
|
||||||
*/
|
|
||||||
public int[] indexesOf(String [] termNumbers, int start, int len) {
|
public int[] indexesOf(String [] termNumbers, int start, int len) {
|
||||||
// TODO: there must be a more efficient way of doing this.
|
// TODO: there must be a more efficient way of doing this.
|
||||||
// At least, we could advance the lower bound of the terms array
|
// At least, we could advance the lower bound of the terms array
|
||||||
|
|
|
@ -25,27 +25,17 @@ public interface TermFreqVector {
|
||||||
|
|
||||||
|
|
||||||
/** Array of term frequencies. Locations of the array correspond one to one
|
/** Array of term frequencies. Locations of the array correspond one to one
|
||||||
* to the term numbers in the array obtained from <code>getTermNumbers</code>
|
* to the terms in the array obtained from <code>getTerms</code>
|
||||||
* method. Each location in the array contains the number of times this
|
* method. Each location in the array contains the number of times this
|
||||||
* term occurs in the document or the document field.
|
* term occurs in the document or the document field.
|
||||||
*/
|
*/
|
||||||
public int[] getTermFrequencies();
|
public int[] getTermFrequencies();
|
||||||
|
|
||||||
|
|
||||||
/** Return a string representation of the vector.
|
|
||||||
*/
|
|
||||||
public String toString();
|
|
||||||
|
|
||||||
|
/** Return an index in the term numbers array returned from
|
||||||
/** Return a string representation of the vector, but use the provided IndexReader
|
* <code>getTerms</code> at which the term with the specified
|
||||||
* to obtain text for each term and include the text instead of term numbers.
|
* <code>term</code> appears. If this term does not appear in the array,
|
||||||
*/
|
* return -1.
|
||||||
public String toString(IndexReader ir) throws IOException;
|
|
||||||
|
|
||||||
|
|
||||||
/** Return an index in the term numbers array returned from <code>getTermNumbers</code>
|
|
||||||
* at which the term with the specified <code>termNumber</code> appears. If this
|
|
||||||
* term does not appear in the array, return -1.
|
|
||||||
*/
|
*/
|
||||||
public int indexOf(String term);
|
public int indexOf(String term);
|
||||||
|
|
||||||
|
|
|
@ -147,63 +147,23 @@ public class QueryTermVector implements TermFreqVector {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The number of terms in the term vector.
|
|
||||||
*/
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return terms.length;
|
return terms.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an array of positions in which the term is found or null if no position information is
|
|
||||||
* available or positions are not implemented.
|
|
||||||
* Terms are identified by the index at which its number appears in the
|
|
||||||
* term array obtained from <code>getTerms</code> method.
|
|
||||||
*/
|
|
||||||
public int[] getTermPositions(int index) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return An Array of term texts in ascending order.
|
|
||||||
*/
|
|
||||||
public String[] getTerms() {
|
public String[] getTerms() {
|
||||||
return terms;
|
return terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Array of term frequencies. Locations of the array correspond one to one
|
|
||||||
* to the term numbers in the array obtained from <code>getTermNumbers</code>
|
|
||||||
* method. Each location in the array contains the number of times this
|
|
||||||
* term occurs in the document or the document field.
|
|
||||||
*/
|
|
||||||
public int[] getTermFrequencies() {
|
public int[] getTermFrequencies() {
|
||||||
return termFreqs;
|
return termFreqs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a string representation of the vector, but use the provided IndexReader
|
|
||||||
* to obtain text for each term and include the text instead of term numbers.
|
|
||||||
*/
|
|
||||||
public String toString(IndexReader ir) throws IOException {
|
|
||||||
return toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Return an index in the term numbers array returned from <code>getTermNumbers</code>
|
|
||||||
* at which the term with the specified <code>termNumber</code> appears. If this
|
|
||||||
* term does not appear in the array, return -1.
|
|
||||||
*/
|
|
||||||
public int indexOf(String term) {
|
public int indexOf(String term) {
|
||||||
int res = Arrays.binarySearch(terms, term);
|
int res = Arrays.binarySearch(terms, term);
|
||||||
return res >= 0 ? res : -1;
|
return res >= 0 ? res : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Just like <code>indexOf(int)</code> but searches for a number of terms
|
|
||||||
* at the same time. Returns an array that has the same size as the number
|
|
||||||
* of terms searched for, each slot containing the result of searching for
|
|
||||||
* that term number.
|
|
||||||
*
|
|
||||||
* @param terms array containing terms to look for
|
|
||||||
* @param start index in the array where the list of terms starts
|
|
||||||
* @param len the number of terms in the list
|
|
||||||
*/
|
|
||||||
public int[] indexesOf(String[] terms, int start, int len) {
|
public int[] indexesOf(String[] terms, int start, int len) {
|
||||||
int res[] = new int[len];
|
int res[] = new int[len];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue