Hi Nick,

I´m doing the drupal 7 port for this module.

The indexing is completed I did it using the hook hook_apachesolr_index_
document_build. Not sure what is the purpose of the other hook, the node hook is not called in the indexing process.

* I also changed the prepare_query function as follows:

From:

function apachesolr_ubercart_apachesolr_prepare_query(&$query)

To:

function apachesolr_ubercart_apachesolr_query_prepare(&$query) {

* For all the module I changed the fs_ to fss_ as the solr xml configuration files changed.

The next stuff to work in is the facets

I found this functions facet related

hook_apachesolr_facets() -> Seems to be the facet definition array but I didn't found the hook anywhere else can you please give me some directions?

Thank you

Comments

nick_vh’s picture

Could you also already add a patch with what you have?

nick_vh’s picture

In the meantime I added a 7.x-1.x branch so we can start playing around

julianmancera’s picture

StatusFileSize
new8.2 KB

Hi Nick,

Here is what I have done so far. Many code is been commented out as it throws php errors.

Julian Mancera

nick_vh’s picture

Hi, I made some work of this issue queue so all the patches in the queue were submitted and verified. Please make sure you work with the latest 6.x branch to backport all of these features :-)

nick_vh’s picture

Also I'd recommend you to make a patch. How to do this?

Go to the directory where you have cloned the module, and then do

git diff origin/6.x-1.x > /some/path/to/save/patches/1402868-#comment-number.patch

julianmancera’s picture

Title: Drupal 7 port » Apachesolr Ubercart Integration Drupal 7 port
StatusFileSize
new28.69 KB

Hi Nick,

Here is the starting patch for the drupal 7 port. Though there is an error that doesn´t allow me to finish it. It is the line number 248. I couldn't find a way to find the current query from the drupal static cache. Not sure why it doesn´t show up. Can you please take a look and give me a hand?

Thank you

Julian Mancera

julianmancera’s picture

StatusFileSize
new23 KB

Nick,

Here is the patch so it works with the new facet api. I tried to find error for it to integrate to the slider module, it seems to be a missing array item in the facetapi module. Here is the code in facetapi.block.inc file line 78

if (isset($builds[$group][$facet_name])) {   // This if statement doesn't pass through the facet is not defined

    // Adds contextual links.
    $builds[$group][$facet_name]['#contextual_links'] = array(
      'facetapi' => array('admin/config/search/facetapi', array($searcher, $realm_name, $facet_name)),
    );

    // Returns the subject and content of the block.
    $variables = array('title' => $builds[$group][$facet_name]['#title'], 'facet' => $builds[$group][$facet_name]);
    return array(
      'subject' => theme('facetapi_title', $variables),
      'content' => $builds[$group][$facet_name]
    );
  }
}

Can you give me a hand on this problem with the facet definition?

Julian Mancera

nick_vh’s picture

Would you be interested in being co-maintainer? For the Drupal 7 port?

Nick

julianmancera’s picture

Hi Nick,

Yes let's do it.

Julian

julianmancera’s picture

Nick,

There is one feature that I need to be implemented in the port. The product image indexing and the inclusion for the Apache sorl Views module. I have develop a views handler my self but I'm not sure how to include image style sizing options for the views creation interface.

Anyone have an idea on how to do it?

function apachesolr_ubercart_views_data_alter(&$data) {
  $data['apachesolr_node']['sm_uc_product_image'] = array(
    'title' => t('Product Image'),
    'help' => t('Ubercart Product Image.'),
    'field' => array(
      //'string' => TRUE,
      'handler' => 'unknow_image_handler',
      'click sortable' => FALSE,
    )
  );
}

Regards,

Julian Mancera

julianmancera’s picture

StatusFileSize
new75.3 KB

Hi Nick

Here is last version. For this we have the following additions

- Ubercart image added for apache solr views
- Add to cart button added for apache solr views

What's missing

- Facet Price slider to work with the slider module
- Testing the D6 features on the D7

Regards

Julian Mancera

julianmancera’s picture

Nick,

For the apache solr views to work you need apply the following patches to the apache sorl view module

http://drupal.org/node/1428630
http://drupal.org/node/1425464
http://drupal.org/node/1428558

Regards,

Julian Mancera

julianmancera’s picture

Hi Nick,

Any notice from webmasters?

Thank you

Julian

nick_vh’s picture

@julianmancera : Check the issue in this project queue. It takes time it seems... :-)

Nick

zeezhao’s picture

Please I have a question that relates to a comment on the home page that says:

"If you are using apachesolr and Ubercart of Drupal Commerce this can be replaced now if you are using fields. Use facetapi and use the widget of your choice to replicate this behavior. A recommended widget is Facet Slider"

- I tried the above approach but could not see any of the fields at where added to my product classes....

In any case, is this approach meant to be an atletnative to apachesolr_ubercart?

julianmancera’s picture

Hi zeezhao,

Not sure if using the Drupal Commerce will put additional fields to a product sounds weird though, the above discussion was meant to port the apache sorl ubercart module and it's integration with apache solr views(so fields can be indexed and shown in views ui), so for example if you want to build a view for listing your products and them filter them by facets you will be able to do so.

Julian Mancera

julianmancera’s picture

Hi Nick,

I found the piece of code where it is the problem for the slider. It is in the query_type_numeric_range.inc file line 31 of the apachesolr module.

public function execute($query) {
    // Check if we have a cache of this field
    //
    $settings = $this->adapter->getFacet($this->facet)->getSettings();
    $active = $this->adapter->getActiveItems($this->facet);

    $singular_field_info = $this->facet['map options'];
    $singular_field_info['multiple'] = FALSE;
    $this->single_key = apachesolr_index_key($singular_field_info);
    // See:  http://wiki.apache.org/solr/StatsComponent
    $query->addParam('stats', 'true');
    $query->addParam('stats.field', $this->single_key);
    $query->addParam('stats.facet', $this->single_key);
    // Range filters don't support OR operator.
    foreach ($active as $value => $item) {
      $query->addFilter($this->single_key, $value);
    }
  }

For some reason the facet['map options'] variable is not set. I hacked it and it works for the ubercart sell price, so the error should be located where the numeric range facet is created.

Let me know your thoughts

Julian Mancera

nyleve101’s picture

Hi,

i can't see the patch for http://drupal.org/node/1425464 is that still needed?

Hope you're well

Eve

julianmancera’s picture

Hi Nick,

I did the facet mapping definition but it doesn't solve the problem with the slider facet, can you please take a look? It is already commited to dev.

/*
 *  Implement hook_apachesolr_field_mappings
 */
function apachesolr_ubercart_apachesolr_field_mappings() {
  $mappings['per-field']['uc_sell_price'] = array(
    'name' => 'uc_sell_price',
    'indexing_callback' => 'apachesolr_fields_default_indexing_callback', 
    'index_type' => 'sfloat',
    'query types' => array('term', 'numeric_range'),
    'query type' => 'term', 
    'facets' => TRUE,
    'multiple' => FALSE
  );
  return $mappings;
}

I strongly suppect that it has to do with the way the slider facet is stored in the database the facet db data states that the slider facet information is undefined.

Any ideas over this.

Regards,

Julian Mancera

julianmancera’s picture

Hi

Here is the db record from the facetapi table

a:7:{s:8:"operator";s:3:"and";s:10:"hard_limit";s:2:"50";s:12:"dependencies";a:0:{}s:14:"facet_mincount";i:1;s:13:"facet_missing";i:0;s:7:"flatten";i:0;s:10:"query_type";s:13:"numeric_range";}

Regards,

Julian

Colin @ PCMarket’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Has anyone managed to get the dev working?
After enabling this module, my ubercart related fields like sku and price etc still do not seem to be indexed.

julianmancera’s picture

Hi PCMarket

Did you reindex all the content? Does the sell price shows in the sorl index report?

Julian Mancera

Colin @ PCMarket’s picture

Hi Julian

Yes I have re-indexed all content, all of the usual fields and my custom fields of each content type are indexed, but non of the ubercart fields such as sell price, list price etc are showing in the solr index report. and as these are not indexed, these are not available as a facet block.

any ideas?

thanks

Colin

julianmancera’s picture

Hi Colin,

Send the apache solr module version to make a test myself.

Regards,

Julian

Colin @ PCMarket’s picture

I am using Apache Solr module version 7.x-1.0-rc5

nyleve101’s picture

Hi,

I am also having the same issue. None of the ubercart price fields are being indexed. Also, when I add the ubercart image field to my views it only shows the file name e.g. test.png.

I'm using apachesolr 7.x-1.1 and Apache Solr Views 7.x-1.0-beta2.

Anyone else experiencing these issues?

nyleve101’s picture

Hi Julian,

any updates on making this compatible with the recent Apache Solr changes?

Hope you're well,

Evelyn

julianmancera’s picture

Hi Evelyn,

Currently there is a bug with the apache solr module that doesn't allow to index the fields that are not included within the field api. That's why you will need to apply this patch to the apache solr

http://drupal.org/node/1595440

Please let me know if it solves it for you.

Julian

nyleve101’s picture

Hi Julian,

the patch doesn't work with the 7.x-1.1 version of apache solr.

Evelyn

rakun’s picture

Issue summary: View changes

I am using Apache Solr Search 7.x-1.7 and Apachesolr Ubercart Integration 7.x-1.x-dev (2013-Sep-30). I tried patch from http://drupal.org/node/1595440 and also tried instructions from the article https://www.drupal.org/node/1965932 but with no luck. None of the ubercart price fields are being indexed. Is there anybody that get this to work?