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

[WIP] Updates the form and configuration #82

Merged
merged 98 commits into from
Apr 25, 2019
Merged

[WIP] Updates the form and configuration #82

merged 98 commits into from
Apr 25, 2019

Conversation

agentrickard
Copy link
Contributor

No description provided.

@agentrickard
Copy link
Contributor Author

I have most of the settings backported and the app JS/CSS updated to v2.0.

Screen Shot 2019-03-20 at 4 58 09 PM

I have not yet touched the block code.

@agentrickard
Copy link
Contributor Author

It's also not clear that I am handling the 'hide' options correctly.

@@ -353,31 +353,31 @@ function search_api_federated_solr_admin($form, &$form_state) {
'#attributes' => [
'id' => ['site-name-property'],
],
'#default_value' => variable_get('search_api_federated_solr_has_site_name_property') ? 'true' : NULL,
'#default_value' => 'true', #variable_get('search_api_federated_solr_has_site_name_property'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Drupal 7 we don't have an "easy" way of determining what fields are present, like we do in D8, so I defaulted all of these to 'true' for the time being.

In D8, we derive these values from $type_property = $index_config->get('field_settings.federated_type');

* Uses the selected index server's backend connector to execute
* a select query on the index based on request qs params passed from the app.
*/
function search_api_federated_solr_proxy() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the part that I just don't quite understand. THe D7 and D8 code for SearchAPISolr is just different enough to be confusing.

$query_fields = array_values($query_fields_map);
}

// If site search is restricted, enforce it here.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can only enforce this if site search is restricted and hidden. Otherwise, it's possible (as in UMich's case) that this could be a subsequent search and the site name facet has been unchecked. See the description for the default site name field: https://github.com/palantirnet/search_api_federated_solr/pull/82/files#diff-819816c1f9a4704c4a9e9f3e53e2d832R185

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's fine.

}
foreach ($params['fq'] as $index => $element) {
if (substr_count($element, 'sm_site_name:') > 0) {
unset($params['fq'][$index]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you walk me through this... is this unsetting the site name if it already exists as a qs param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, to ensure we aren't sending more than one value to the server.

}
}
// @TODO: This value might be configurable? Get from SearchAPI config.
$params['fq'][] = 'sm_site_name:("' . variable_get('site_name') . '")';
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this should just equal the value of the site name property on the index.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just fixed that part in a subsequent commit.

@@ -73,7 +71,8 @@ dpm($index);
}

// If site search is restricted, enforce it here.
$restrict_site = variable_get('search_api_federated_solr_set_search_site', 0);
$restrict_site = variable_get('search_api_federated_solr_set_search_site', 0)
&& variable_get('search_api_federated_solr_hide_site_name', 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jesconstantine Since this only works with the proxy right now, should we force the proxy to be used in configuration, or just set a note in the UI that the proxy must be enabled?

Copy link
Contributor

Choose a reason for hiding this comment

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

The only time it won't work is if the site is not using the proxy AND the search page is browsed to directly, right? I think we can make a note in the UI with that restriction.

I also envision a near future where we only support using the proxy (or a view for autocomplete).

@agentrickard agentrickard merged commit 9fc28a3 into 7.x-2.x Apr 25, 2019
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