Drupal Adding apache solr index for field-collection

3 Aug

If images / content are bounded by field collection module, you can try approach below to index to solr

enjoy

 

//Index product images

$field_collection_items = field_get_items(‘node’, $node, ‘field_image_set’);

$field_collection_item_ids = array();

$i = 0;

foreach ($field_collection_items as $field_collection_item){

$field_collection_item_ids[$i] = $field_collection_item['value'];

$i++;

}

$field_collection_item_fields = entity_load(‘field_collection_item’, $field_collection_item_ids);

$image_fields = array();

$i = 0;

foreach ($field_collection_item_fields as $field_collection_item_field){

$image_fields[$i] = field_get_items(‘field_collection_item’, $field_collection_item_field, ‘field_image’);

$i++;

}

 

$i = 0;

foreach ($image_fields as $image_field){

foreach ($image_field as $image)

$path = file_create_url($image['uri']);

$document->setMultiValue(‘sm_field_image_’.$i++, $path); //Set multiple field_image values

}

 

Adding index to apache solr by Drupal hook

3 Aug
1. Add index by setMultiValue

function scp_solr_search_apachesolr_update_index(&$document, $node){
$document->setMultiValue(‘sm_field_xxxx’,
$node->field_xxxx['und'][0]['value']);

2. Add modify query

function scp_solr_search_apachesolr_modify_query(&$query, $caller){
$query->params['fl'] .= ‘,sm_field_xxxx’;

3. update solr and done ~!

* scp_solr_search is my module name Enjoy

To be loved

3 Aug

The song i love most

 

 

My latest configuration

3 Aug

technical sharing session – Drupal @ecvision

3 Aug

Online marketing in China

13 Oct
Recently, I met my friend's cousin. She comes from ShangHai – A first class city in China. I went to ShangHai two times and really feels opportunity out there. I believe many people are headache about getting into China market. It is harsh to setup retail business or making any sales. Due to the great firewall, social network services & many online marketing stuffs are blocked.

BTW, with my friend's cousin – Nico, she is an online marketer in China who responses to brand New balance / North Face, I start to realize how to make things works in China. Firstly, we should make a mapping on SNS

Foreign SNS China SNS Description
Facebook renren.com More on college students
Twitter t.sins.com.cn (微博) More on superstars, feel link up with other websites
MySpace www.kaixin001.com (開心網) For all people
Linkedin www.wealink.com (若領) More on mainland jobs
Posterous *Still have room for competiton
YouTube tudou.com (土豆) Many anime, do not have copyright at all

All knows technology are the same

You will find China SNS and foreign SNS nearly take no difference on technology behind. But, content has big different.
Since nearly no foreign people in China SNS, the culture is China only while foreign SNS is a global mixture. Unlike foreign SNS, China people take very serious on making online friends. They  afraid of be traded, advertisement, fake good …. etc. Don't ever think to make friends like twitter – Follow some people, like others' post, find common interest / expertise …. Spirit communication not that useful at all. 

If you are making online business

Everything in kaixin need money, commonly like facebook group/page, it need money to create. No free advertising even you have many collections. The budget in China online marketing should be higher than using twitter / facebook.

The only way is to ask your China friend to share his/her network 

I have to say, if you can add friends in China SNS you already know, it will be much better. In China, online or offline, like you find a job, you cannot find a job about your good experience but making good friends matter. This culture goes on to Internet. Just like twitter followers — Provided that your followers are famous, you must have great power of influence.

Not many management tools available

I don't know the reason, TweetDesk not supporting kaixin / t.sina or you are going to make one !

It is really slow …

I'm talking about the network, especially overseas… If you are remote control like in US / UK, you better have an proxy ! You may left your message and I get one for you.

How to make things work?

Other than hiring China writers, SNS operators … you still need to make good decisions in a very very rapid changing market… Further, A China law said foreign business should be cooperate with local business in order to setup in China. Frankly speaking, it cannot be done on your own, since you don't have time to understand, to learn and to pay for the totally different China culture. It is hard for me even I am a Hong Kong 80afters. Not kidding, left your message and I introduce Nico to you, you will safe your life.

Update

When I get more understanding, I will come back and share about how to deal with China people over Internet ~

Thanks

2010-09-14 15.02.13

16 Sep
My new setup in UTStar ~! tup in P

I’m now in China

13 Sep
Hi All,

I’m now in China, working @UTStarcom…
Twitter & facebook @ posterous are not available … Keep in touch and Try my best ~ :P

See u all

my desktop

3 Sep

Search Engine Optimization / online marketing – Content is King

30 Aug
← Older Entries

Follow

Get every new post delivered to your Inbox.