|
Hi.
I am not able to perform a faceted discrete request. My configuration is based on a working document on which I already run 'normal' requests.
I've just added a faceted field to my document:
@Field(analyze = Analyze.NO)
@Facet
private long dateByTen;
I create a query with this:
final FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
final QueryBuilder builder = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Phrase.class).get();
final FacetingRequest phraseFacetingRequest = builder.facet()
.name("phrases")
.onField("dateByTen")
.discrete()
.orderedBy(FacetSortOrder.FIELD_VALUE)
.includeZeroCounts(false)
.maxFacetCount(3)
.createFacetingRequest();
final Query luceneQuery = builder.all().createQuery();
final FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery(luceneQuery, Phrase.class);
final FacetManager facetManager = fullTextQuery.getFacetManager();
facetManager.enableFaceting(phraseFacetingRequest);
final List<Facet> facets = facetManager.getFacets("phrases");
The exception described in title is raised at search time. While in debug there is the following nested exception :
From QueryHits.updateStringFacets method:
java.lang.IllegalArgumentException: field "$facets" was not indexed with SortedSetDocValues
The code looks inside the 'fieldInfo' map for the '$facets' field. But this map contain only the filedname I've defined in the document. I don't understand why it's not looking for the 'dateByTen' field instead of '$facets'
Does the indexing code must change to perform faceting queries?
Note: Using a faceting range query works.
Best Regards,
|