Rokko_11 NA (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate Search (
https://hibernate.atlassian.net/browse/HSEARCH?atlOrigin=eyJpIjoiODc5N2Fj...
) / Bug (
https://hibernate.atlassian.net/browse/HSEARCH-3978?atlOrigin=eyJpIjoiODc...
) HSEARCH-3978 (
https://hibernate.atlassian.net/browse/HSEARCH-3978?atlOrigin=eyJpIjoiODc...
) Exception when using elasticsearch and multiple analyzers for indexed field in
projection query. (
https://hibernate.atlassian.net/browse/HSEARCH-3978?atlOrigin=eyJpIjoiODc...
)
Issue Type: Bug Affects Versions: 5.11.5.Final Assignee: Unassigned Components:
backend-elasticsearch Created: 31/Jul/2020 03:30 AM Labels: search Priority: Minor
Reporter: Rokko_11 NA (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Hello,
I annotate a field of an @Indexed class with two analyzers.
@Field(store = Store.YES, analyzer = @Analyzer(definition = "phonetic" ))
@Field(store = Store.YES, analyzer = @Analyzer(definition = "ngram" ))
private String value;
Now I use following query:
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
Query query = fullTextEntityManager.getSearchFactory()
.buildQueryBuilder()
.forEntity(itemClass)
.get()
.keyword()
.onField( "value" )
.matching(value)
.createQuery();
FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery(query);
fullTextQuery.setProjection(
ProjectionConstants.ID,
ProjectionConstants.OBJECT_CLASS,
ProjectionConstants.SCORE,
"value"
);
List< Object []> resultList = fullTextQuery.getResultList();
When I use Lucene as backend it works.
When I use Elasticsearch as backend i get following exception:
Caused by: java.lang.IllegalStateException
at com.google.gson.JsonArray.getAsString(JsonArray.java:226)
at
org.hibernate.search.elasticsearch.query.impl.PrimitiveProjection.addDocumentField(PrimitiveProjection.java:69)
at
org.hibernate.search.elasticsearch.query.impl.PrimitiveProjection.addDocumentField(PrimitiveProjection.java:43)
at
org.hibernate.search.elasticsearch.query.impl.TwoWayFieldBridgeProjection.convertFieldValue(TwoWayFieldBridgeProjection.java:60)
at
org.hibernate.search.elasticsearch.query.impl.TwoWayFieldBridgeProjection.convertHit(TwoWayFieldBridgeProjection.java:43)
at
org.hibernate.search.elasticsearch.query.impl.QueryHitConverter.convert(QueryHitConverter.java:186)
at
org.hibernate.search.elasticsearch.query.impl.IndexSearcher.convertQueryHit(IndexSearcher.java:138)
at
org.hibernate.search.elasticsearch.query.impl.ElasticsearchHSQueryImpl.queryEntityInfos(ElasticsearchHSQueryImpl.java:233)
at
org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.doHibernateSearchList(FullTextQueryImpl.java:240)
at
org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.list(FullTextQueryImpl.java:225)
at
org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.getResultList(FullTextQueryImpl.java:124)
Breakpointing in com.google.gson.JsonArray.getAsString(JsonArray.java:226) it turns out
that this.elements has size of 2. When I add a third @Field annotation, this.elements is
3. When I remove a field, this.elements is 1 and it works.
Kind regards
(
https://hibernate.atlassian.net/browse/HSEARCH-3978#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-3978#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100140- sha1:33445dc )