Skip navigation
All Places > Developer > Blog > 2015 > August
2015

Here is a guest post from a couple members of the Sugar Developer community.  Yann Berges and Cédric Mourizard from Synolia, an Elite SugarCRM Partner, share some insights on how to improve the quality of Elasticsearch results in Sugar.

 

Elasticsearch in Sugar 7

Since Sugar 6.5, Elasticsearch has been included as a core feature of the Sugar Application and became a required component in Sugar 7.x releases. You can find some information regarding installation, configuration, and monitoring of Elasticsearch in the Knowledge Base.

It works very well and is pretty fast!

However, the default configuration is often too strict with diacritics such as accent and stressed letters found in languages like French.  For example, the default configuration will not match e with é during a global search which is not desirable for us.

 



Below we will explore how Elasticsearch Analyzers can be used to address this issue.  It is quite easy and does not require custom code!

 

To improve the global search with this type of capability you need to setup an Analyzer. Analyzers are how Elasticsearch generates tokens from input data to be indexed. You can also combine analyzers for multiple transformations; like converting text to lowercase, utilize a list of stopwords to exclude some words and lot of capabilities, or apply regular expressions.

 

Configuring Elasticsearch Analyzers in Sugar 7.6

One of the out of the box analyzers called asciifolding is for converting Unicode characters into lower ASCII, when they exist.  To add this type of configuration you could do that very easily with an entry in $sugar_config.

Add the following configuration setting to your config_override.php at the root of your Sugar 7.6 installation.  You may need to create this PHP file if it doesn't exist already.  The significant part is the line where the 'asciifolding' filter is added.

SugarElasticsearchConfgWithAsciifolding.php

<?php

$sugar_config['full_text_engine']['Elastic']['index_settings']['default']['index'] = array(
'analysis' => array(
'analyzer' => array(
'core_email_lowercase' => array(
'type' => 'custom',
'tokenizer' => 'uax_url_email',
'filter' => array(
'lowercase',
                ),
            ),
'standard' => array(
'type' => 'custom',
'tokenizer' => 'standard',
'filter' => array(
'asciifolding',
'lowercase',
                ),
            ),
        ),
    ),
);

After updating your config, you need to do a Quick Repair & Rebuild and perform a full system index which will rebuild the index data using this new additional analyzer.

Now if one of your modules contains, for example, cooking recipes then you can now search “Saute” and find the right results with or without accents like “Sautéed Tuna Steaks”

 



Enjoy your (Elastic)search!

Have you checked out the Current Opportunities at SugarCRM lately?  We're hiring heavily today across all sorts of technical roles at Sugar - including an open position to work with me as a Developer Advocate for SugarCRM!

 

What does a Sugar Developer Advocate do?

 

In the past, the term the industry tended to use was "Developer Evangelist" - which frankly always sounded a bit fishy to me.  For me, I much preferred the term "Developer Advocate" which is now much more common in the Software industry.  An Evangelist sounds like someone who is more style than substance.  An Advocate is someone who should listen as much as they talk.

 

This means that Sugar Developer Advocate act as ambassadors to the Sugar Developer community as well as being a critical stakeholder within SugarCRM Engineering that represents the wants and needs of Sugar Developer community and the Sugar 7 platform.  I think this is a great position for anybody with some good software development experience who is energetic, has good communication skills, has a positive attitude, and loves working with developers!

 

Check out the posting for more details!

A long established tradition within Engineering here at SugarCRM is something that we call "Hack Week".  A couple times a year we fly our engineers from all over the world to our headquarters in Cupertino, CA for a week of fun, creativity, and some serious hacking.  On the week of July 27th 2015, it happened again!

 

https://twitter.com/jenny_gonsalves/status/625758911409172481

 

Hack Format

 

The format for these events vary but by far everyone's favorite is more of a freestyle event.  Prior to this event, we create a JIRA project for everyone to start entering their project ideas.  Project ideas varied widely - better Sugar development tooling, improving our test infrastructure, small Sugar product improvements, or grand new ideas and research projects.  Then on Monday these Sugar-related project ideas as well as last minute ones are written on the whiteboard in the Engineering huddle.

Remember Sweet Spot?  This started as a hack week project from early this year.

 

Engineers get to decide what they want to work on, so volunteers stand up in front of the whiteboard and pitch their ideas to the group until everybody has had their say.  Then we get to work!

 

https://twitter.com/jenny_gonsalves/status/625761174684958720

 

Guest Attendees

 

With so many people from Engineering in one place, this becomes a great opportunity to bring in guests from Sugar Developer community in order to network with the team, learn a whole lot, and get answers to their Sugar 7 questions from the talent that built it and maintain it.

 

So in the spirit of increased collaboration, we decided to invite a handful of developers from our US based partners to participate.

We had guest developers from Levementum, Faye BSGArcsona participate in this hack week.

 

Team Building

 

On Monday evening, we held a team building event in downtown Palo Alto which was a blast!  Our guests were also invited for those brave enough to participate!

 

We partnered with The Go Game to put on a VERY entertaining movie making competition.  Teams were randomly assigned and given a duffel bag full of props that matched one of several common film genres.  We were given 2 hours to create short films based on these themes that ranged from romance (Oooh la la!) to science fiction.

 

https://twitter.com/jenny_gonsalves/status/626086820116238337

 

We then got to enjoy a private screening of each of our films during dinner that evening at Pampas.

By the end of the night, every film qualified as award winning.  But none of us will be quitting our day jobs.

 

https://twitter.com/jenny_gonsalves/status/626087975428816896

 

In a follow up post, we will discuss more about the 16(!!) different projects Sugas and guests worked on and give you a peek at the project demos that were presented on Thursday, July 30th.