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

Add extra_options to search #80

Merged
merged 1 commit into from
Oct 28, 2015
Merged

Add extra_options to search #80

merged 1 commit into from
Oct 28, 2015

Conversation

foobacca
Copy link
Contributor

My use case is just to add defType=edismax which means I get better
results. The way to use it is to do:

myquery = myquery.add_extra(defType='edismax')

And you could also use it to add other dismax parameters (eg qf, mm ...)

There are probably better ways to do this, and it is certainly unsafe
with zero error checking, but it allows me to do what I need.

My use case is just to add defType=edismax which means I get better
results.  The way to use it is to do:

    myquery = myquery.add_extra(defType='edismax')

And you could also use it to add other dismax parameters (eg qf, mm ...)

There are probably better ways to do this, and it is certainly unsafe
with zero error checking, but it allows me to do what I need.
@foobacca
Copy link
Contributor Author

To be clear, I'm not expecting this pull request to be accepted as is, but as it solves my problem others might be interested, and it can be a starting point for discussion about supporting dismax or other options.

As you've asked for the use case before, my use case is just to use edismax instead of the standard query parser, as it gives more relevant results for exact matches, even without adding any of the extra dismax parameters. But I build pretty complex queries for the q parameter, so want to keep the chainable queries provided by sunburnt.

If you are interested in starting from here and improving then one modification would be to change add_extra() to add_dismax_options() and restrict it to the options that are valid for dismax/edismax - defType, q.alt, qf (Query Fields), mm (Minimum 'Should' Match), qs (Query Phrase Slop) etc. See dismax and edismax for the full list of options.

Another refinement would be to split into dismax_options() and edismax_options() which would implicitly add the defType parameter and limit the fields available for each. Using both dismax and edismax should then be an error.

Let me know if you're interested in these approaches or similar and I'll work up a better solution - but if you're not then I'll just carry on using my little hack.

@mlissner
Copy link
Contributor

Thanks for this PR, @foobacca. In the issue above I'm trying to push it into Scorched as well, since that seems to be where the energy is these days.

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

Successfully merging this pull request may close these issues.

3 participants