We're updating the issue view to help you get more done. 

Search with bool, must, onFields and matching returned duplicate records

Description

With the following search test:

1 2 3 4 5 6 QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity( ProductArticle.class ).get(); System.out.println(" passing 2 ...."); org.apache.lucene.search.Query query = qb .bool() .must(qb.keyword().onFields("header").matching("hibernate").createQuery()) .createQuery();

its search result returns duplicate records.
Please refer to the result as shown below:

1 java.lang.AssertionError: [query result] expected size:<1> but was:<23> for <[[1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [1, hibernate query, 2013-03-24 11:05:30.0], [3, the only tool, 2013-03-15 11:05:30.0], [3, the only tool, 2013-03-15 11:05:30.0], [3, the only tool, 2013-03-15 11:05:30.0], [3, the only tool, 2013-03-15 11:05:30.0], [3, the only tool, 2013-03-15 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0], [2, hibernate lucen, 2013-03-14 11:05:30.0]]>

I have also attached a sample project for the test case as reference.

Environment

Windows 7, JBOSS 7.2.0, Maven, Junit Test.

Status

Assignee

Hardy Ferentschik

Reporter

samw

Labels

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Affects versions

4.2.0.Final

Priority

Major