[DATASOLR-153] Improve support for DisMax and eDisMax query parsers Created: 14/Mar/14  Updated: 06/Nov/19

Status: Open
Project: Spring Data for Apache Solr
Component/s: Core, Repository
Affects Version/s: 1.1.1 (Codd SR1)
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Scott Rossillo Assignee: Christoph Strobl
Resolution: Unresolved Votes: 2
Labels: Neumann
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Last updater: Matthew Hall
Pull Request URL: https://github.com/spring-projects/spring-data-solr/pull/35

 Description   

Currently there is no way to pass DisMax and e DisMax query parameters to Solr, although the query parser can be set. This initial patch adds support for the query fields parameter (qf) .

There are other options I would like to add, but this one is key to getting basic DisMax and e DisMax queries working. Additionally, it would probably be prudent to have a discussion about the best way to support the plethora of options available for these query parsers before I just jump in and add them to SimpleQuery.



 Comments   
Comment by Christoph Strobl [ 18/Mar/14 ]

Thank you Scott Rossillo for opening the pull request.

The idea of support for additional query parsers like eDisMax is generally speaking composed of 3 parts.

  1. a (new) Query type/interface (eg. DisMaxQuery) for adding specific operations.
  2. a (new) QueryParser that can create the SolrQuery to be executed.
  3. a QueryParserPair for those types registered in QueryParsers.

This should allow to add specific support for solr query parsers available.

There is already an implementation in place that follows this approach. So you could have a look at TermsQuery and the TermsQueryParser.

I hope this helps.

Comment by Scott Rossillo [ 19/Mar/14 ]

Thanks Christoph Strobl, that feels like the right direction to take. I redo my work based on your suggestions and send a new pull request.

Comment by Christoph Strobl [ 19/Mar/14 ]

great - looking forward to it!

Comment by Scott Rossillo [ 20/Mar/14 ]

Christoph Strobl, there's one thing I'm having trouble reconciling with current codebase vs a native Solr query. HightlightQuery and FacetQuery are distinct interfaces with their own implementations. However, a highlight query and a facet query aren't mutually exclusive in Solr. The same applies to a DisMax query, it's not mutually exclusive from a facet and/or highlight query. There's no reason a user shouldn't be able to execute a query that enables faceting, highlighting and supplies DisMax options to Solr.

Am I missing something here or is there no way of executing a facet query with highlighting enabled in Spring Data Solr?

Comment by Christoph Strobl [ 24/Mar/14 ]

You are absolutely right about this. Hope to be able to target this issue in 1.3.

Comment by Scott Rossillo [ 24/Mar/14 ]

Ok, so I'll proceed with DisMax separately as you suggested for now. I have some thoughts on how combining queries could be easily done without completely redesigning everything.

Comment by Christoph Schachinger [ 06/Oct/15 ]

Since there is no movement here I just wanted to post the workaround I'm using. I created my own QueryParser (derived from the DefaultQueryParser) and am overriding the appendDefType(SolrQuery solrQuery, String defType) method and register it to the solrTemplate. If the defType is set to "edismax", I'm setting the "qf" parameter on the solrQuery accordingly and voila, edismax query is working as expected.

Comment by Jamel ESSOUSSI [ 15/Apr/16 ]

Hi,

I would like to add "mm" edismax parameter in the Solr Request. Can you please explain how register the extended QueryParser to the solrTemplate ?

Best regards

Comment by Matthew Hall [ 19/Jul/19 ]

Hi I have created a PR for this (at present just disMax but if you guys are happy with the work i can extend to eDismax).  It adds simple dismax support to the default query parser. I have tried to follow existing patterns . Can I use this ticket number to submit the PR or create a new issue (probably creates clutter)

 

Kind regards

Comment by Matthew Hall [ 26/Jul/19 ]

created this PR https://github.com/spring-projects/spring-data-solr/pull/113

 

Kind regards,

Matt Hall

Comment by Christoph Strobl [ 30/Jul/19 ]

thanks for reviving this issue. As we're already pretty far with the current release train I've marked this to be considered for the next one.

Comment by Matthew Hall [ 30/Jul/19 ]

OK great, thanks. In the meantime let me know if I need to make any improvements (I will take a look myself as well).  Also let me know if you want something similar done for eDisMax

Comment by Matthew Hall [ 06/Nov/19 ]

Hi guys is there any update on if / when this will be released?

Generated at Sun Dec 15 08:41:43 UTC 2019 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.