Giter VIP home page Giter VIP logo

elasticsearch_helper_content's Introduction

Elasticsearch Helper Content

Start

  • Enable thew modules: drush -y en elasticsearch_helper_instant
  • Configure the following viewmodes of your relevant entities to contain sensible data (or have the default view mode handle it):
    • search_index - used by default for indexing content of an entity
    • search_result - used by default for search result output of an entity
  • Setup new indices: drush elasticsearch-helper-setup
  • (Re-) Index the data:
    • drush elasticsearch-helper-reindex
    • drush queue-run elasticsearch_helper_indexing

Decide whether an entity is indexed

You can decide whether an entity is indexed via custom hook implementation:

function HOOK_elasticsearch_helper_content_source_alter(&$source) {
  // Only index nodes of bundle article or event.
  if ($source instanceof \Drupal\node\Entity\Node) {
    if (!in_array($source->bundle(), ['article', 'event'])) {
      $source = FALSE;
    }
  }
}

Manually set a render theme

When indexing an entity, the entity's render output for viewmodes search_index and search_result are also stored in ES. By default, the default frontend theme is used to do that. But you can specify a different theme in settings.php:

$settings['elasticsearch_helper_content'] = [
  'render_theme' => 'my_awesome_theme_name',
];

Skip default normalize

When indexing an entity, the provided ElasticsearchContentNormalizer provides some metadata across entity types as well as it's parent classContentEntityNormalizer's default normalization, which is quite verbose and might not be intended in some cases. To skip providing this default normalization, set the following in your settings.php:

$settings['elasticsearch_helper_content'] = [
  'skip_default_normalize' => TRUE, // or _any_ other value.
];

elasticsearch_helper_content's People

Contributors

becizzz avatar danielnolde avatar guncha25 avatar maijs avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mitrpaka

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.