Mailing List Archive

LuceneTestCase altered the default query cache policy
Hello community,

I am a developer that work for Amazon Product Search. Recently I have experienced a use scenario that I altered the IndexSearcher’s default query cache policy but some of our unit tests that extended to LuceneTestCase failed. It take me some time to figure it out LuceneTestCase actually override the IndexSearcher’s defaultQueryCahchingPolicy in its before class.

We think it would be a great feature that if LuceneTestCase could make an assertion that if custom query cache policy has been set, we should not need to override the default query policy? Or at least make an assertion, so developer can catch the test bug earlier?

Want to share and know community’s idea on this.

Thanks&Regards,
Yuan



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
LuceneTestCase altered the default query cache policy [ In reply to ]
Hello community,

I am a developer that work for Amazon Product Search. Recently I have experienced a use scenario that I altered the IndexSearcher’s default query cache policy but some of our unit tests that extended to LuceneTestCase failed. It take me some time to figure it out LuceneTestCase actually override the IndexSearcher’s defaultQueryCahchingPolicy in its before class.

We think it would be a great feature that if LuceneTestCase could make an assertion that if custom query cache policy has been set, we should not need to override the default query policy? Or at least make an assertion, so developer can catch the test bug earlier?

Want to share and know community’s idea on this.

Thanks&Regards,
Yuan



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: LuceneTestCase altered the default query cache policy [ In reply to ]
Hi Yuan,

[.Disclaimer: I work in the same team at Amazon, customer facing product
search, where we heavily use Lucene at high scale!]

LuceneTestCase already has similar assertions, e.g. to confirm that no
system properties were changed, no threads leaked, not too much static
objects left referenced, etc.

I think it'd make sense to also assert that tests did not leave
IndexSearcher's default cache and cache policy changed? In general tests
should not alter any of the mutable global state in the JVM.

Maybe open an issue / PR on GitHub and we can discuss it there?

Mike McCandless

http://blog.mikemccandless.com


On Mon, Jun 26, 2023 at 5:26?PM Yuan Xiao <yuan.tu.xiao@gmail.com> wrote:

> Hello community,
>
> I am a developer that work for Amazon Product Search. Recently I have
> experienced a use scenario that I altered the IndexSearcher’s default query
> cache policy but some of our unit tests that extended to LuceneTestCase
> failed. It take me some time to figure it out LuceneTestCase actually
> override the IndexSearcher’s defaultQueryCahchingPolicy in its before
> class.
>
> We think it would be a great feature that if LuceneTestCase could make an
> assertion that if custom query cache policy has been set, we should not
> need to override the default query policy? Or at least make an assertion,
> so developer can catch the test bug earlier?
>
> Want to share and know community’s idea on this.
>
> Thanks&Regards,
> Yuan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>