lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tricia Williams <>
Subject TermDocs.freq()
Date Thu, 29 Sep 2005 15:53:27 GMT
I am finding that TermDocs.freq() method is returning an incorrect value.
I was wondering if anyone else had experienced this problem.

I am using tp = IndexReader.termPositions( queryTerm ) to return a object
which implements TermPositions.  I then use tp.skipTo( docid ) to go
directly to the document from which I wish to retrieve term positions. The
following for loop adds the positions to my ArrayList which I use later:

for( 	int pos = tp.nextPosition(), k = 0;
	k < tp.freq();
	pos = tp.nextPosition(), k++ )
	positionMatches.add( new Integer( pos ) );

In a document which I know has 48 references to the term, a frequency of
23 is returned.  There doesn't seem to be a pattern to this as some other
documents have (frequency, actual): (25, 48), (36, 43), (30, 149).

These frequencies are from results within my code and confirmed in Luke,
so I'm pretty certain that this isn't an error on my part.

I've been trying to find out where the origin of this issue is without
luck thus far.  Any help or advice would be appreciated.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message