0

Am attempting to understand the report in admin/reports/apachesolr (Drupal 6). There are a large number of fields, and I am trying to understand

1) Are these the fields within the Solr index that are being populated, or are these within Drupal?

2) Assuming they are the Solr index fields, how can I make reference to them? For example, I have added a custom module that hooks into hook_apachesolr_modify_query

$query->add_filter("type", 'job'); // Works fine

$query->add_filter("sis_cck_field_job_approved", 1); // Unsure

Will this filter on those custom CCK fields?

In addition, I am attempting to customise the way that the search captures search terms, applies those additional terms to specific fields and potentially saves them for emailing at a later date. With a little research I have come across Panels + Apache Solr Panels as one approach, and Views 3 and Apache Solr Views as an alternative approach. Is either preferred for a production site? I am specifically looking to

1) Add extra field filters to the search form

2) Build custom field filters (e.g. between Date X and Y)

3) Format the returning results, to show / hide specific node data, and censor particular fields based on a role.

Greatly appreciate all and any response!

Craig Moore

1

I think that you may find that the Apache Solr Views module will do what you are wanting fairly well.

|improve this answer|||||
0

Looks like work is still being done on the date field side of things - see http://drupal.org/node/642430 for patch posted July 11 2011

|improve this answer|||||
0

Just for the record, I am outlining what I ended up doing.

I created a custom module using hook_block, a quick test to what roles the user had, and then rendering a custom form (using the forms api). The form had a collection of fields, some of which were dropdowns etc populated from the "allowed values" from the various fields, e.g.

// Get the global_settings like you described.

$serialized_data = db_result(db_query("select global_settings from content_node_field where field_name='field_job_type'"));

$unserialized_data = unserialize($serialized_data);

foreach (explode("\n", $unserialized_data['allowed_values']) as $type) {

$type = trim($type);
$types[$type] = $type;

}

$form['contract_type'] = array(

'#type' => 'select',
'#title' => t('Contract type'),
'#options' =>$types,

);

with a callback that essentially constructed a url and submitted it with drupal_goto(), in the format

url

/search/apachesolr_search/test

parameters filters=created:[2011-04-23T13:37:09Z%20TO%202011-07-22T13:37:09Z]%20&solrsort=created%20desc

etc

So to recap I used hook_block, a custom_job_search_form() function to generate the form, fed it into drupal_get_form() to render the form, and finally a custom_search_my_job_form_submit() which processed the variables and updated with drupal_goto.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.