Michal Kroliczek created SOLR-7142:
--------------------------------------
Summary: TestFaceting.testFacets senseless
Key: SOLR-7142
URL: https://issues.apache.org/jira/browse/SOLR-7142
Project: Solr
Issue Type: Test
Components: faceting
Reporter: Michal Kroliczek
Priority: Trivial
Hi, I am new to Solr sources and I was digging in facet tests.
I found unreasonable block of code in TestFaceting.testFacets:
{code}
... ( 1st document is added and assertion is done)
// test gaps that take more than one byte
sb = new StringBuilder();
sb.append(t(0)).append(' ');
sb.append(t(150)).append(' ');
sb.append(t(301)).append(' ');
sb.append(t(453)).append(' ');
sb.append(t(606)).append(' ');
sb.append(t(1000)).append(' ');
sb.append(t(2010)).append(' ');
sb.append(t(3050)).append(' ');
sb.append(t(4999)).append(' ');
assertU(adoc("id", "2", "many_ws", sb.toString()));
assertQ("check many tokens",
req(**"q", "id:1"**,"indent","true"
,"facet", "true", "facet.method","fc"
,"facet.field", "many_ws"
,"facet.limit", "-1"
)
,"*[count(//lst[@name='many_ws']/int)=5000]"
,"//lst[@name='many_ws']/int[@name='" + t(0) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(150) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(301) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(453) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(606) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(1000) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(2010) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(3055) + "'][.='1']"
,"//lst[@name='many_ws']/int[@name='" + t(4999) + "'][.='1']"
);
{code}
This code adds second document, never commits and executes second query with
q=id:1 again.
So test will pass even if:
1) Change assertions to ID's not related to 2nd document (like 2001)
2) Add commit after 2nd document added (still filter is set to id:1)
3) Remove at all creating 2nd document.
Patch changes test flow to fallowing:
1) add document1 and commit
2) assert facets to query *:*
3) add document2 and commit
5) assert query *:* to have facetes with values 1 and 2 when expected
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]