Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for DisMax and eDisMax query parsers [DATASOLR-153] #275

Open
spring-projects-issues opened this issue Mar 14, 2014 · 17 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 14, 2014

Scott Rossillo opened DATASOLR-153 and commented

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


Affects: 1.1.1 (Codd SR1)

Referenced from: pull request #35

5 votes, 10 watchers

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 18, 2014

Christoph Strobl commented

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.

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 19, 2014

Scott Rossillo commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 19, 2014

Christoph Strobl commented

great - looking forward to it!

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 20, 2014

Scott Rossillo commented

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?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 24, 2014

Christoph Strobl commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 24, 2014

Scott Rossillo commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 6, 2015

Christoph Schachinger commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Apr 15, 2016

Jamel ESSOUSSI commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jul 19, 2019

Matthew Hall commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jul 26, 2019

Matthew Hall commented

created this PR #113

 

Kind regards,

Matt Hall

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jul 30, 2019

Christoph Strobl commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jul 30, 2019

Matthew Hall commented

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 :)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 6, 2019

Matthew Hall commented

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jun 20, 2020

Ahmedfcis commented

you can use edismax library for spring-solr https://github.com/KmSYS/edismax-solr-spring

But to overcome the problem of overwrite the registered query parsers at afterPropertiesSet() you need to override the method as following,

@Bean
public SolrTemplate solrTemplate(SolrClient client) {
  

  SolrTemplate template = new SolrTemplate(client) {

        @Override
        public void afterPropertiesSet() {
                  super.afterPropertiesSet();
                  registerQueryParser(SimpleEdismaxQuery.class, new EdisMaxQueryParser(new SimpleSolrMappingContext()));
               }
        };
   return template;
}

 

Also, sample code at https://github.com/KmSYS/edismax-solr-spring-sample

http://www.kmsys.tech/solr/edixmax-query-parser-template.html

 

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jun 23, 2020

Anjali Shrivastava commented

Yes boosting a record is very important feature and would like to see it's support in spring data solr

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 2, 2020

Matthew Hall commented

Christoph Strobl Do you know if this feature will be released and if so do you have an estimated release or release date?

 

Cheers

@matthall103
Copy link

@matthall103 matthall103 commented Jan 22, 2021

any update on this would be much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants