Author: ssmiweve Date: 2009-01-29 12:02:04 +0100 (Thu, 29 Jan 2009) New Revision: 7180
Modified: branches/2.18/query-api/src/main/java/no/sesat/search/query/finder/Counter.java Log: fix a possible bug where a second call to getTermCount with a different argument would return the cached result from the first call Modified: branches/2.18/query-api/src/main/java/no/sesat/search/query/finder/Counter.java =================================================================== --- branches/2.18/query-api/src/main/java/no/sesat/search/query/finder/Counter.java 2009-01-28 14:51:23 UTC (rev 7179) +++ branches/2.18/query-api/src/main/java/no/sesat/search/query/finder/Counter.java 2009-01-29 11:02:04 UTC (rev 7180) @@ -1,4 +1,4 @@ -/* Copyright (2007-2008) Schibsted Søk AS +/* Copyright (2007-2009) Schibsted Søk AS * This file is part of SESAT. * * SESAT is free software: you can redistribute it and/or modify @@ -36,15 +36,18 @@ private Integer termCount = null; - /** - * - * @param root - * @return + private Clause root = null; + + /** Get the count of leaves under this clause. + * Subsequent calls with the same argument will return a cached result. + * @param root the clause to count leaves within + * @return the number of LeafClauses found under the root clause. */ public synchronized int getTermCount(final Clause root) { - if( termCount == null ){ + if(root != this.root){ termCount = 0; + this.root = root; visit(root); } return termCount; _______________________________________________ Kernel-commits mailing list Kernel-commits@sesat.no http://sesat.no/mailman/listinfo/kernel-commits