Joomla Elasticsearch

broken image


An ElasticSearch extension for Joomla. Contribute to wilsonge/jes development by creating an account on GitHub. ElasticSearch is purposed to improve a Joomla website's, giving a user full control over search form and search results. It supports our extensions: DJ-Classifieds and DJ-Catalog2. The latest version brings a new Facet Filters feature which allows filtering search results by custom fields of DJ-Classifieds extension. Geek ElasticSearch is the most powerful, extremely fast, highly relevant and flexible search and filter system for your Joomla site. Our extension uses the Elasticsearch engine - a highly scalable open-source full-text search and analytics engine to index data and perform the search. Hence, it is possible to index, search, and analyze large volumes of data quickly and return search results in near real-time that other. Geek ElasticSearch is the most powerful, extremely fast, highly relevant and flexible search and filter system for your Joomla site. Our extension uses the Elasticsearch engine - a highly scalable open-source full-text search and analytics engine to index data and perform the search.

A list of top frequently asked C# interview questions and answers are given below.

1) What is C#?

C# is a simple, modern, general purpose programming language. It is an object oriented programming language developed by Microsoft. It is a safe and managed language that is compiled by .NET framework to generate Microsoft intermediate language (machine code).

2) What is the reason behind the invention of C#?

C# is designed for Common Language Infrastructure (CLI). It contains the executable code and runtime environment that makes the users able to use various high-level languages on different computer platforms and architectures.

3) What are the main reasons to use C# language?

These are top reasons to use C# language:

  • Easy to learn
  • General purpose and object oriented programming language
  • Component oriented
  • Structured language
  • Can be compiled on variety of computer platforms
  • Produces efficient programs
  • Part of .net framework

4) What is the difference between public, static and void?

You can access public declared variables anywhere in the application.

Static declared variables are globally accessible without creating an instance of the class.

Void is a type modifier that specifies that the method doesn't return any value.

5) What are constructors in C#?

A constructor is a member function in the class and has the same name as its class. Whenever the object class is created, the constructor is automatically invoked. It constructs the value of data members while initializing the class.

6) What are the different types of constructors in C#?

Basically, there are five types of constructors:

  • Static constructor
  • Private constructor
  • Copy constructor
  • Default constructor
  • Parameterized constructor

7) What is static constructor?

Static constructor is used to initialize static data members as soon as the class is referenced first time.

8) What is method overloading in C#?

Method overloading is mechanism to create multiple methods with the same name and unique signature in the same class. When you go for compilation, the compiler uses overload resolution to determine the specific method to be invoked.

9) Is overriding of a function possible in the same class?

No

10) What is array?

Array is a set of related instances either value or reference types.

There are three types of array supported by C#:

  • Single Dimensional Array: It contains a single row. It is also known as vector array.
  • Multi Dimensional Array: It is rectangular and contains rows and columns.
  • Jagged Array: It also contains rows and columns but it has an irregular shape.

11) What is ArrayList?

ArrayList is a dynamic array. You can add and remove the elements from an ArrayList at runtime. In the ArrayList, elements are not automatically sorted.

12) What is a collection?

A collection works as a container for instances of other classes. All classes implement ICollection interface.

13) What is an interface?

Interface is an abstract class that has only public abstract method. These methods only have declaration not the definition. These abstract methods must be implemented in the inherited classes.

14) What is the lock statement in C#?

Lock statement is used to ensure that one thread doesn?t enter a critical section of code while another thread is in the critical section. If another thread attempts to enter a locked code it will wait, block, until the object is released.

15) What is serialization?

If you want to transport an object through network then you have to convert the object into a stream of bytes. The process of converting an object into a stream of bytes is called serialization.

16) How to declare a property in a class?

int m_PersonID = 0;public int PersonID{get { return m_PersonID; }set { m_PersonID = value; }}

17) What is the difference between early binding and late binding in C#?

Early binding and late binding are the concept of polymorphism. There are two types of polymorphism in C#.

  • Compile Time Polymorphism: It is also known as early binding.
  • Run Time Polymorphism: It is also known as late binding or method overriding or dynamic polymorphism.

18) Which are the access modifiers available in C#?

Following are the access modifiers generally used for accessibility:

Joomla Elasticsearch
  • Public: If you define an attribute or method as public, it can be accessed from any code of the project.
  • Private: A private defined attribute or method can be accessed by any code within the containing class only.
  • Protected: If you define the method or attribute as protected it can be accessed by any method in the inherited classes and any method within the same class.
  • Internal: If you define an attribute or a method as internal, it is restricted to classes within the current position assembly.
  • Protected internal: If you define an attribute or method as protected internal, access is restricted to classes within the current project assembly or types derived from the containing class.

19) What is the difference between abstract class and interface in C#?

Abstract class can have abstract and concrete methods whereas interface has only abstract methods.

20) What is the difference between dispose() and finalize() methods in C#?

The dispose() method is explicitly called by user to free unmanaged resources such as files, database connections etc whereas finalize() method is implicitly called by garbage collector to free unmanaged resources like files, database connections etc.

The dispose() method belongs to IDisposable interface whereas finalize() method belongs the Object class.

21) What is the difference between method overloading and method overriding in C#?

Method parameters must be different in method overloading whereas it must be same in method overriding.

Inheritance is not required in method overloading, it occurs within the same class. But inheritance is required in method overriding.

22) What is object pool in .Net?

Object pool is a container of ready to use objects. It reduces the overhead of creating new object.

23) What is delegate in C#?

A delegate in C# is an object that holds the reference to a method. It is like function pointer in C++.

24) What is Hashtable?

A Hashtable is a collection of key/value pairs. It contains values based on the key.

25) What is Reflection?

Reflection allows us to get metadata and assemblies of an object at runtime.

26) What is Garbage Collection?

Garbage Collection is a process of releasing memory automatically occupied by objects which are no longer accessible.


Java Basics Interview QuestionsJava OOPs Interview Questions
Java Multithreading QuestionsJava String & Exception Questions
Java Collection Interview QuestionsJDBC Interview Questions
Servlet Interview QuestionsJSP Interview Questions
Spring Interview QuestionsHibernate Interview Questions
PL/SQL Interview QuestionsSQL Interview Questions
Oracle Interview QuestionsAndroid Interview Questions
SQL Server Interview QuestionsMySQL Interview Questions

Requirements

  • cURL is installed and enabled
  • Version Matrix
  • ElasticSearch VersionPHP Version Required
    7.x7.1+
    6.x7.0+
    5.x5.5+
    2.x5.5+
  • Please read this aritcle for How to Upgrade Your Website PHP Version
  • How to check PHP version is running on your website
    • From the Backend of Joomla site
    • Go to SystemSystem Information: this screen contains all system information you may need, the Joomla! Version currently running, and also PHP, database versions and so on.

Configure Searchly service

Searchly.com provides powerfull features to fulfill your Elasticsearch deployment with a reasonable price. On this section, we will guide you how to create and configure Elasticsearch service on Searchly.

If you already have Elasticsearch service installed on your server or use Elasticsearch from another provider, you can use that one and skip this step. However, you need to manage permission to access your service by yourself.

Create Searchly account

  • Open http://www.searchly.com/
  • Select a plan that suits your needs
  • It has a free 'Starter' plan that enables you to create up to 10 Search spaces, and each can create 2 indices with 20MB of storage that can index up to 5K documents.
  • Sign up and verify your account.

Create Search Space

  • Once your account is verified, you can login its dashboard.
  • You will be redirected to the page where you can create Search Space for the first time login.
  • Type a name for Search Space, select Region, and select version 7 (recommend), version 6, version 5 or version 2 for Elasticsearch version.
  • Choose Create

Create Indices

  • Searchly will grant access to specific indices. Hence, you need to create indices first, then create access key and grant access to them.
  • Select Dashboard > Indices to open the Indices Manager page where you can create an index.
  • Chose New Index
  • On Create New Index form Enter index name
  • Choose Create button

Create Access Keys and Set up Access Policy

You need to create 2 different Access Keys to index, one is for index request in back-end and one is for search on front-end. Select ACL > Access Keys to open the Access Keys Manager page where you can create an access keys.

Create Private Access Key for Index request

  • Choose Create New Access Key
  • Type Access Key Name
  • Uncheck for Read Only option
  • Select indices that you grant access for.
  • Choose Create

Create Public Access Key for Search request

  • Choose Create New Access Key
  • Type Access Key Name
  • Check for Read Only option
  • Select indices that you grant access for.
  • Choose Create

Get Connection Urls

  • Click on Details button to open page where you can view details about your Access Key and get Connection Url

Configure Integration

  • Copy Connection URLs of Private Access Key and Public Access Key and enter them correspondingly to Endpoint and Search Endpoint params on Configuration form of Geek Elasticsearch component.
  • Enter index name what you created to Index param.
  • Save changes.

Configure Amazon ElasticSearch Service

If you already have Elasticsearch service installed on your server or use Elasticsearch from another provider, you can use that one and skip this step. However, you need to manage permission to access your service by yourself.
On this documentation, we will guide you to create Amazon Elasticsearch service and manage its access policy.

If you are looking for an alternative provider of hosted search solution which is away from AWS, Searchly.com is an option that offer you a good service with a reasonable price.

Create AWS Account

  • If you already have an AWS account, you can skip this step.
  • When you sign up for Amazon Web Services (AWS), your AWS account is automatically signed up for all services in AWS, including AWS Elasticsearch Service (Amazon ES).
  • To create an AWS Account
  • Open http://aws.amazon.com/, and then choose Create an AWS Account.
  • Follow the instructions to sign up. You need to enter payment information before using Amazon ES. There are no sign-up fees, and charges are not incurred until you create a Elasticsearch domain. You have to pay for the resources that you use only.

Create IAM Account

Services in AWS including Amazon ES, require you to provide credentials when you access them, so that the service can determine whether you have permissions to access the resources owned by that service. You can create access keys for your AWS account to access the API. However, we don't recommend you to access AWS using the credentials for your AWS account. We recommend that you use AWS Identity and Access Management (IAM) instead.

To create an IAM user.

  • Go to Console Home page
  • Under Security & Identity, choose Identity & Access Management
  • Or you can directly sign in to the Identity & Access Management (IAM) console at https://console.aws.amazon.com/iam/.
  • On navigation pane, choose Users ->Create New Users.
  • In input text 1, type a username and check the checkbox Generate an access key for each user
  • Choose Create
  • Save Access key ID + Access Secret Key to the safe place on your computer, or you can click on Download Credentials button to download csv file.
  • Choose Close to return back to list of users page
  • On list of users, choose the name (not the checkbox) of the user you created, you can use Search box to search for username.
  • On user detail page, Save User Amazon Resource Name (User ARN), you can also create another Access Key in this page

Create ElasticSearch Domain

  • Go to https://aws.amazon.com
  • Sign in to the console with your AWS account
  • Select Region where you want to create Elasticsearch Service in.
  • You can select region from Dropdown menu item (next to Support menu item) on the top menu
  • Tips: you should select regions near your customers to reduce data latency of your applications.
  • Under Analytics, choose Elasticsearch Service.

Step 1. Choose Deployment Type

Choose Deployment Type and select the Elasticsearch version for your domain.

Step 2. Configure Domain

  • Domain Name: On the Define domain page, for Domain name, type a name for the domain. The name must start with a lowercase letter and must be between 3 and 28 characters. Valid characters are a-z (lowercase only), 0-9, and - (hyphen).
  • For Instance type, choose an instance type for the Amazon ES domain.
  • AWS Free tier
    • If your AWS account is eligible for the AWS Free Usage Tier you can select t2.micro.elasticsearch (Free tier eligible) for Instance type
    • The AWS Free Tier includes usage of up to 750 hours per month of a t2.micro instance type and up to 10 GB of Magnetic or General Purpose EBS storage. Lean more. Amazon Elasticsearch Service Free Tier.
  • Choose Next

Step 3. Configure access and security

  • Network Connection: Choose Public Access
  • Select Custom Access Policy, then use a Custom Policy Builder below to add element with following settings:
    • Column 1: Select IAM User
    • Column 2: Enter IAM User ARN (created above)
    • Column 3: Select Allow
  • Choose Next

Step 4. Review

Review the information, and then choose Confirm to create a domain.

Step 5. Get AWS ES Endpoint

  • Wait for about 10 minutes for the domain to be initialized.
  • Once your AWS Elasticsearch domain is created successfully, you can get Endpoint URL of Elasticsearch domain.

Step 6. Modify Access Policy

  • In the Step 3. Configure access and security, we configured access to allow IAM User to have full access to domain. But in our case, everyone can also search data from front-end of website, so we will have to edit the access policy to do that.
  • Choose Actions > Modify Access Policy
  • Copy and paste the JSON code below to replace the content in the textbox Add or edit the access policy
  • Replace the [IAM_ARN] with your IAM user ARN, and replace [ELASTICSEARCH_ARN] with Elasticsearch ARN.
  • Choose Submit to save changes.

Avoiding Unexpected Charges

  • AWS Elasticsearch Service Free tier enables you to create single-AZ t2.micro.elasticsearch instance. If you create more than one Elasticsearch domain, you will have to pay for what you use.
  • Learn more about AWS Free tier limits https://aws.amazon.com/free/
  • You can check your free tier usage on the Billing and Cost Management console.
  • Read more about how to Avoiding Unexpected Charges

Install Component

  • Download install package from our download section here
  • Install it as normally via Joomla installer, it will install Geek Elasticsearch component and its all sub extensions.

Configuration

  • Configure component
  • How to access.
  • Click on Options button at any screen of Geek Elasticsearch admin to access its configuration form.

ElasticSearch Service

Setting Description

Elasticsearch Version

Select a version of Elasticsearch that you use. Depend on Elasticsearch service that you use, It can be a version of Elasticsearch installed on your server, or of AWS Elasticsearch Domain or of Searchly Search Space.

Check Version Matrix first to select the ElasticSearch version that matches the version of PHP installed on your server.

Endpoint

An endpoint is a URL that is the entry point for an Elasticsearch service.
- If you use AWS Elasticsearch service, you can get Endpoint url here.
- If you use Searchly service, It is a Connection URL for index request.

Search Endpoint

For Elasticsearch service that provide different endpoint urls for search request and index request, such as Searchly.
If you use Searchly service, you can get Connection URL for search request here.
If you use other Elasticsearch services, you can leave this field blank.

Index

Name of index where your data will be stored in.

NOTE: an index is like a 'database' in a relational database, you must use different index for each sites if you have multiple ones.

AWS Region

Select a AWS region where you create an ElasticSearch service in - See Create Elasticsearch Domain section (for AWS ElasticSearch service only).

If you use other-AWS ElasticSearch service, you can ignore this setting.

Username

Enter the username for the user. If you use AWS ElasticSearch service, it can be a username of your AWS account or Access Key Id of IAM user.

Password

Enter the password for the user. If you use AWS ElasticSearch service, it can be a password of your AWS account or Secret Access Key of IAM user.

Send Indirect Request (Send search request through server script)By default, the search module will send direct AJAX request to ElasticSearch service.
But if ElasticSearch service is behind a Firewall and it only allows access from specific IPs, then the direct ajax request from client won't work.
In this case, you need to enable this setting, then the search module will send ajax request to your server, after then the server script will send request to your ElasticSearch service.
NOTE: If you enable this setting, you should create a new menu item with type 'Geek ElasticSearch > Search Endpoint'. This will help to create SEF url for search endpoint.

Index and search

Setting Description

Last run index time

The last time when index runs successfully.

Indexer Batchsize

The batch size controls how many items are processed per batch. Large batch sizes require lots of memory whereas small batch sizes require less memory but execute more requests which tends to take longer.

Title Text Weight Multiplier

The multiplier is used to control how much influence matching text has on the overall relevance score of a search result. A multiplier is considered in relationship to the other multipliers. The title text comes from the title of the content.

Body Text Weight Multiplier

The multiplier is used to control how much influence matching text has on the overall relevance score of a search result. A multiplier is considered in relationship to the other multipliers. The body text comes from the summary and/or body of the content.

Path Text Weight Multiplier

The multiplier is used to control how much influence matching text has on the overall relevance score of a search result. A multiplier is considered in relationship to the other multipliers. The path text comes from the SEF URL of the content.

Enable Logging

Enable this option to create a log file in your site's logs folder during the index process. This file is useful for troubleshooting issues with the index process. It is recommended that logging be disabled unless necessary.

Search Analytics

Setting Description

Collect Search Terms

Enable this option to collect search terms submitted by users. Then you can filter and analyze search terms on this page.

Permissions

Enable indexing plugins

  • The Indexing plugins are which the logic is built to search for items from specific component and return them to Indexer to update the ElasticSearch index. Without these plugins, data from a component cannot be indexed and processed during searching from the Geek ElasticSearch search form.
  • On Dashboard of component, click on Manage button on Indexing Plugins section to open plugin manager pages where you can enable / disable plugins associated with components that you want their data will be indexed in Elasticsearch.
  • IMPORTANT NOTE!: enables only indexing plugins for 3rd components what are installed on your site.

Disable Finder (Smart Search) plugins

  • Because we will use Geek Elasticsearch to replace Joomla Smart Search, it is no longer need to update Joomla! Smart Search index and you can disable all Finder plugins butSmart Search - Geek ElasticSearchto ignore unnecessary process.

Trigger Events Plugins

  • These plugins provide functions which are triggered during the content creation process of Joomla! components and immediately update the ElasticSearch index.

Run Indexer

  • Once you completely setup Elasticsearch service and configure component as well as enable indexing plugins, you need to run indexer to index data in Elasticsearch.
  • There are some ways and options to run indexer:

Run full index:

  • Click on Index button on toolbar at any screen of component. It will re-index all content of your site.

Run incremental index:

  • Click on Incremental Index button on toolbar at any screen of component. It will index only new content and update content from Last indexing time run .

Setup cron job:

  • Geek ElasticSearch supports Trigger Events Plugins that help ElasticSearch index up-to-date automatically whenever content items are amended. However, there are some 3rd components not support these Trigger Events plugins to trigger its content creation process or there are some circumstances which you need to re-run the indexer.
  • You can do this manually using Index / Incremental Index toolbar button on the Geek ElasticSearch admin page. You can re-index content automatically by running indexer as a command-line application. This makes it particularly convenient to run the indexer from a cron job.
  • All hostings support to create cron job, but there might be difference of how to create. If you don't know how to do that, you can ask your hosting provider. The Create a Cron Job form is look like image below
  • You need to specify the time or times when the job is run and the command to run.
  • For the command, you can copy it from Dashboard page on Geek Elasticsearch component admin, it is look like as below
  • /path/to/php-f/home/www/demo/cli/geekelasticsearch_indexer.php
  • Replace the /path/to/php with path to the PHP 5.5.0+ (Because application requires PHP 5.5.0+ to run). Ask your hosting provider for this path if you do not know where this path is.
  • NOTE: crontab will always run incremental index.

Manage indexed content

  • This screen shows a list of all the content items indexed in ElasticSearch.
  • Index - runs the Geek Elasticsearch Indexer. A small popup window will appear with a progress bar which illustrates the indexing process working through the content on your site. Do not close this popup window until the process is finished. On sites which have large amount of content it may take a long time for the indexing (tens of minutes).
    NOTE: Geek Elasticsearch indexer can be run from the command-line interface (CLI) if required. See
    Setting up cron job section for more detail.
  • Incremental Index - runs the Geek Elasticsearch Indexer, but it only update the index for those content items that have changed since the index was last updated.
  • Publish - makes selected items available to visitors on your website.
  • Unpublish - makes the selected items unavailable to visitors on your website.
  • Delete - deletes the selected content items. Works with one or multiple content items selected. Deleting a content item from Elasticsearch only deletes it from the index and does not affect the content item itself.
  • Clear Index - you use this feature when you need to completely clear all the existing index entries before completely rebuilding the index.

Joomla Elasticsearch Free

Create and publish module

  • Go to modules manager page.
  • Create new instance of Module Geek Elasticsearch.
  • Update settings for Search icon, search form and search result to suit your need.
  • Publish and assign module to module position on your template.

Update Index Settings

On this screen, the left column shows the current settings information of the index, and the right column shows the form where you can add and put settings to your index.

'Update Index Settings' is an advanced feature that enables to take full advantage of Elasticsearch's abilities. It enables you to configure the analyzer for the index, to change Character Filters, Tokenizer and Token Filters to meet the requirements of search that your website needs.

You have to add settings in JSON format from the code editor, then click on the 'Put Settings' button to send an updated request of index settings. If your settings arevalid and updated successfully, you will see the new updated settings on the left column.

This is an advanced feature, in order to use this feature, we assume that you have basic knowledge of configuring Elasticsearch. So if you have no idea how to use this feature, please do not put any update settings to avoid unexpecting errors.

Some example of analyzers

Magento Elasticsearch

Elasticsearch provides some built-in analyzers for your reference. You can copy sample settings from the guide pages to update your index settings.

Please NOTE that Geek ElasticSearch does not support specify analyzer for the fields, it uses default analyzer for all text fields by default. So instead of creating custom analyzers, you need to update the default analyzer, and new settings will be applied to all fields without a need for updating mapping.

For more details, when you copy settings from the Elasticsearch guide page, you need to replace the name of the custom analyzer to 'default'. For example if the sample settings code is:

You need to replace the name of analyzer that is 'rebuilt_arabic' to 'default' as follows:

Language Analyzers

Drupal Elasticsearch

Language Analyzers are a set of analyzers aimed to analyzing specific language texts. The following types are supported: arabic, armenian, basque, bengali, brazilian, bulgarian, catalan, cjk, czech, danish, dutch, english, estonian, finnish, french, galician, german, greek, hindi, hungarian, indonesian, irish, italian, latvian, lithuanian, norwegian, persian, portuguese, romanian, russian, sorani, spanish, swedish, turkish, thai.
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lang-analyzer.html

ASCII Folding Token Filter

This Token Filter converts alphabetic, numeric, and symbolic characters that are not in the Basic Latin Unicode block (first 127 ASCII characters) to their ASCII equivalent, if one exists. For example, the filter changes à to a.
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-asciifolding-tokenfilter.html

This means that you can search accent-insensitive, for example if the document contains the text:
Vous êtes le Phénix des hôtes de ces bois.
Then you can use searchwords below to find it:
etes, Phenix, hotes
You can use the settings below to enable this feature:

Lowercase token filter

The Token Filter changes token text to lowercase. This will enable the implementation of incase-sensitive search
For example, you can use the lowercase filter to change THE Lazy DoG to the lazy dog.
In addition to the default filter, the lowercase token filter provides access to Lucene's language-specific lowercase filters for Greek, Irish, and Turkish.
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenfilter.html

You can use the settings below to enable this feature:

You can also use many token filters together as follows:

NOTE:
After the index settings updated successfully, You might need to re-index data to get new changes applied in documents.

IMPORTANT NOTE:
Configuring Elasticsearch is out of our support scope. So, you need to update your index settings by yourself. If you need us for this help, please submit a request for Elasticsearch - installation service to This email address is being protected from spambots. You need JavaScript enabled to view it., we will check and reply you for a cost estimation cost of thetime that we need to spend.

Search Analytics

  • This screen enables you to filter and analyze users' search terms to better understand what they are looking for on site.
  • Note: You need to enable Collecting search terms setting on configuration page to get search terms collected. This setting is disabled by default.




broken image