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

Search 6 groundwork - Fail-fast in Lucene DSL

Description

See https://github.com/hibernate/hibernate-search-6-poc/pull/29#discussion_r177384297

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Yoann: I made sure to convert the value as soon as possible in the Elasticsearch implementation, so as to produce clear stack traces when an error occurs (the stack trace will mention the line where the user passed the parameter). If we don't, we run the risk of the error being reported as late as when org.hibernate.search.v6poc.search.query.spi.SearchQueryBuilder#build is called, and that would leave the user wondering where exactly he made a mistake (in which predicate). Do you think you could convert the value here, instead of leaving it up to the query builder? One solution would be, instead of relying on the LuceneFieldQueryBuilder to create the match query, to expect it to create the MatchPredicateBuilder instead. Then the builder could perform all sort of operations knowing perfectly which type it expects as input. Also this would allow us to get rid of the Options object. To be clear, instead of having this in org.hibernate.search.v6poc.backend.lucene.search.predicate.impl.SearchPredicateFactoryImpl: @Override public MatchPredicateBuilder<LuceneSearchPredicateCollector> match(String absoluteFieldPath) { return new MatchPredicateBuilderImpl( absoluteFieldPath, searchTargetModel.getFieldQueryBuilder( absoluteFieldPath ) ); } ... we would have something like this: @Override public MatchPredicateBuilder<LuceneSearchPredicateCollector> match(String absoluteFieldPath) { return searchTargetModel.getFieldQueryBuilderFactory( absoluteFieldPath ).createMatchBuilder( absoluteFieldPath ); } Guillaume: That would create a dependency predicate -> model and I'm not sure I like that. Do you mind if we keep this discussion for later? Yoann: Yes and no, the predicate implementations could still be in the same package, and wouldn't need to have a dependency to the model. They would just be instantiated by the "FieldQueryBuilderFactory". If you are talking about the dependency from SearchPredicateFactoryImpl to the model, it's already there. Ok, let's discuss this later, I'll add it to the google doc.

Environment

None

Status

Assignee

Guillaume Smet

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major