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

Custom facet value nil exception #1256

Conversation

peetucket
Copy link
Contributor

Proposed fix for #1255 including 2 new tests.

@@ -282,7 +282,7 @@ def facet_value_to_fq_string(facet_field, value)

case
when (facet_config and facet_config.query)
facet_config.query[value][:fq]
facet_config.query[value].blank? ? '-*' : facet_config.query[value][:fq]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is -* actually a Solr query? I think you might mean -*:*?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this can this be simplified any?

facet_config.query[value].blank? ? '-*' : facet_config.query[value][:fq]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. yup -: is what i meant will fix
  2. i thought that was pretty succint, any suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I wasn't thinking about succinctness, more about clarity and understandability. Maybe something like this?

if facet_config.query[value]
  facet_config.query[value][:fq]
else
  # exclude all documents for the bogus facet query key
  '-*:*'
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, ok, more readable to humans, will update

@cbeer
Copy link
Member

cbeer commented Oct 7, 2015

Thanks. Want to squash your commits?

@peetucket peetucket force-pushed the custom-facet-value-nil-exception branch from e0e1942 to d1005c2 Compare October 7, 2015 22:43
@peetucket
Copy link
Contributor Author

Commits squashed

@cbeer
Copy link
Member

cbeer commented Oct 7, 2015

Can you update the commit message to describe this change a little better?

…r requests a custom facet query value that does not exist (fixes projectblacklight#1255)
@peetucket peetucket force-pushed the custom-facet-value-nil-exception branch from d1005c2 to c119f0c Compare October 7, 2015 23:15
cbeer added a commit that referenced this pull request Oct 9, 2015
@cbeer cbeer merged commit 77a31d3 into projectblacklight:release-5.x Oct 9, 2015
@cbeer
Copy link
Member

cbeer commented Oct 9, 2015

👍

@peetucket
Copy link
Contributor Author

Thanks. Quick question, will this get cherry-picked into v6.x or does that need a separate request?

@cbeer
Copy link
Member

cbeer commented Oct 9, 2015

Yes, I merged it into master in #1257. In the future, it would be better if you targeted pull requests at master and we backported it from there.

@peetucket
Copy link
Contributor Author

ok. good to know, thanks.

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.

2 participants