advanced search and config stuff

66 views
Skip to first unread message

Molly Pickral

unread,
May 3, 2012, 2:16:58 PM5/3/12
to blacklight-...@googlegroups.com
I just spent way more time than I'd care to admit debugging something,
and I think the BL advanced could be improved to play a little better
with Blacklight with respect to the which "qt" gets used.

Here's what had me confused... In the README for Blacklight advanced
search, it says:

"If your application uses a single Solr qt request handler for all its
search fields, then this plugin may work well with no configuration."

Hey -- that's me! So I figure I'm good to go, but when I load up my
advanced search page, I have no facets. Boo!

The configuration examples at:

https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb

show this:

config.default_solr_params = {
:qt => 'search',
:rows => 10
}

and I've basically got that. But, as it turns out, Blacklight
advanced search doesn't look for
blacklight_config.default_solr_params[:qt]. In
blacklight_advanced_search/app/controllers/blacklight_advanced_search/advanced_controller.rb,
you can see:

input.merge!( :qt => blacklight_config.advanced_search[:qt] ||
blacklight_config.default_qt , :per_page => 0)

I've worked around it by adding the following to my
CatalogController's blacklight_config:

config.default_qt = "search"

So, does it seem reasonable to update Blacklight advanced search to
look for blacklight_config.default_solr_params[:qt] instead of
config.default_qt?

Also, the README for Blacklight advanced search says:

"Solr request handler to use for any search that includes advanced
search criteria. Defaults to what the application has set as
Blacklight.config[:default_qt]"

which should also be updated to use the new configs (and possibly
changed as I suggested above).

If these changes are acceptable to you all, I can go ahead and do them.

Molly

Jonathan Rochkind

unread,
May 3, 2012, 2:52:46 PM5/3/12
to blacklight-...@googlegroups.com, Molly Pickral
It does sound like BL itself changed, and advanced search wasn't updated
to take care of it. I guess config.default_qt doesn't exist anymore,
it's config.default_solr_params.qt instead now, is that right?

However, I'm confused -- I just did a fresh install of BL and advanced
search myself, and it did work fine with defaults. Let me look at mine
and see what the difference is..... Huh, I don't know, I am also using
config.default_solr_params.qt and it worked fine. A fresh install of BL
following all instructions, to make sure everything worked, I did a few
weeks ago when I was getting advanced search to actually work as
documented under BL3.

I am a bit troubled by the fact that I can't reproduce, so don't really
understand what's going on.

But if you're pretty sure you do understand what's going on, and that it
applies to out of the box BL install without breaking it, go ahead and
commit? I'd say leave the existing places it looks intact, for
backwards compat and just in case, just add the new one, something like:

input.merge!( :qt => blacklight_config.advanced_search[:qt] ||
blacklight_config.default_qt ||
blacklight_config.default_solr_params.qt, :per_page => 0)

Does that make sense?

David Mautz

unread,
Jul 22, 2013, 4:51:22 PM7/22/13
to blacklight-...@googlegroups.com, mp...@virginia.edu
I also had an issue like this and had to do both of these fixes (denoted by # lines):

    #input.merge!( :qt => blacklight_config.advanced_search[:qt] || blacklight_config.default_qt , :per_page => 0)
    input.merge!( :qt => blacklight_config.advanced_search[:qt] || blacklight_config.default_solr_params[:qt] , :per_page => 0)
    input.merge!( blacklight_config.advanced_search[:form_solr_parameters] ) if blacklight_config.advanced_search[:form_solr_parameters]
    input[:q] ||= '{!lucene}*:*'

    #find(input.to_hash)
    find(0,input.to_hash)

For some reason the find function in blacklight is using args[1] so I had to pass in a value in the args[0] spot.
Reply all
Reply to author
Forward
0 new messages