A Lucene Bug (LUCENE-2142) in the FieldCacheImpl is not returning the multiples terms of the doc. (Debugging it realized it actually reads it, but only return the last one)
In the Apache's Jira it states it was finally fixed after the 4.0-ALPHA. But I got several problems when I try to compile hibernate-search with that version of lucene.
I leave an example of my problem, probably somebody has already faced this issue and came with a solution. (patch, a fix by an aspect, magic? )
Thanks in advance!!!Example:Let's take the Hibernate Search QuickStart (org.hibernate:hibernate-search-quickstart) as an example.
There we have the Authors and Books in a many-to-many relationship.
if we tweek the data in order to have only one book with multiple authors like this:
Code:
INSERT INTO BOOK VALUES (57, '2006-03-16', '', 'title 1');
INSERT INTO AUTHOR VALUES (85, 'author 1');
INSERT INTO AUTHOR VALUES (86, 'author 2');
INSERT INTO AUTHOR VALUES (87, 'author 3');
INSERT INTO AUTHOR VALUES (88, 'author 4');
INSERT INTO BOOK_AUTHOR VALUES (57, 85);
INSERT INTO BOOK_AUTHOR VALUES (57, 86);
INSERT INTO BOOK_AUTHOR VALUES (57, 87);
INSERT INTO BOOK_AUTHOR VALUES (57, 88);
and then create a Discrete facet based on the authors.name.
The result we get from the search is:
Code:
Query Results:
Book: [title: "title 1", authors: [author 2, author 1, author 3, author 4]]
Authors Facet:
author 4 (1)
Gerard