the search api in drupal 8
play

The Search API in Drupal 8 Thomas Seidl (drunken monkey) Disclaimer - PowerPoint PPT Presentation

The Search API in Drupal 8 Thomas Seidl (drunken monkey) Disclaimer Everything shown here is still a work in progress. Details might change until 8.0 release. B a s i c a r c h i t e c t u r e S e r v e r I n d e x V


  1. The Search API in Drupal 8 Thomas Seidl (drunken monkey)

  2. Disclaimer Everything shown here is still a work in progress. Details might change until 8.0 release.

  3. B a s i c a r c h i t e c t u r e S e r v e r I n d e x V i e w s ● T ● G e n e r i c i n f o r m a t i o n e c h n i c a l i m p l e m e n t a t i o n ● U ● D s e s d a t a b a s e / S o l r / … a t a s o u r c e s F a c e t s ● F i e l d s ● S e a r c h ? h o w ● P r o c e s s i n g … ● S e a r c h ? w h a t

  4. S e r v e r ● C o n f i g u r a t i o n e n t i t y ● U s e s „ b a c k e n d “ p l u g i n f o r o p e r a t i o n s ● S t o r e s p l u g i n a n d s p e c i f i c s e t t i n g s

  5. B a c k e n d ● P l u g i n f o r s e r v e r s ● I m p l e m e n t a t i o n o f s e r v e r o p e r a t i o n s ● I n d e x i n g , d e l e t i n g , s e a r c h i n g ● R e a c t i o n t o c h a n g e d i n d e x e s ● C u s t o m c o n f i g u r a t i o n f o r m ● C o n n e c t s t o s t o r a g e ( D B , S o l r , … )

  6. I n d e x ● C o n f i g u r a t i o n e n t i t y ● M a i n c o n n e c t i o n t o o t h e r m o d u l e s ● P l u g i n s : ● „ D a t a s o u r c e s “ p r o v i d e d a t a ● „ T r a c k e r “ t r a c k s i n d e x e d d a t a ● „ P r o c e s s o r s “ a l t e r d a t a / w o r k f l o w

  7. D a t a s o u r c e ● I n d e x p l u g i n p r o v i d i n g a s p e c i f i c k i n d o f d a t a ● E . g . , n o d e s , c o m m e n t s , e x t e r n a l d a t a ● L o a d i n g , v i e w i n g , m e t a d a t a f o r t y p e s ● D a t a s o u r c e - s p e c i f i c c o n f i g u r a t i o n

  8. T r a c k e r ● I n d e x p l u g i n t r a c k i n g s t a t e o f i t e m s ● R e a c t s t o n e w / c h a n g e d / d e l e t e d i t e m s ● Wh i c h i t e m s s t i l l n e e d t o b e i n d e x e d ?

  9. P r o c e s s o r ● I n d e x p l u g i n c h a n g i n g d a t a / w o r k f l o w ● A l t e r i n d e x e d i t e m s a n d s e a r c h q u e r i e s ● C o n f i g u r a b l e ● ( F u s e d w i t h D 7 „ d a t a a l t e r a t i o n s “ )

  10. I n d e x i n g D a t a s o u r c e s P r o c e s s o r s I n d e x T r a c k e r 2 . L o a d i t e m s 4 . A l t e r 5 . E x t r a c t s f i e l d s 1 . D e t e r m i n e s m e t a d a t a c h a n g e d i t e m s 3 . P r o v i d e m e t a d a t a 7 . S e n d s i t e m s t o 6 . P r e p r o c e s s 1 0 . M a r k s i t e m s a s s e r v e r f i e l d s / i t e m s i n d e x e d S e r v e r 8 . I n d e x e s i t e m s 9 . R e t u r n s i n d e x e d i t e m s

  11. S e a r c h i n g S e a r c h Q u e r y P r o c e s s o r s S e r v e r 3 . P a r s e s k e y w o r d s 1 . C r e a t e s q u e r y 6 . P r e p r o c e s s 7 . R e t r i e v e s r e s u l t s q u e r y 2 . A d d s k e y w o r d s 8 . P o s t p r o c e s s 4 . A d d s f i l t e r s , s o r t , s e a r c h r e s u l t s e t c . 5 . E x e c u t e s q u e r y 9 . D i s p l a y s r e s u l t s

  12. C u s t o m i z a t i o n s

  13. B a c k e n d p l u g i n ● I n t e g r a t e S e a r c h A P I w i t h n e w e n g i n e s /** * @SearchApiBackend( * id = "MODULE_my_service", * label = @Translation("My backend"), * description = @Translation("Really cool!") * ) */ class MyService extends BackendPluginBase { function indexItems($index, $items) {} function deleteItems($index, $ids) {} function deleteAllIndexItems($index) {} function search($query) {} }

  14. B a c k e n d p l u g i n ● A l s o a v a i l a b l e : ● C o n f i g u r a t i o n f o r m ● R e a c t t o n e w / c h a n g e d / r e m o v e d i n d e x e s ● C R U D „ h o o k s “ ● supportsFeature() , supportsDatatype()

  15. F e a t u r e s ● A d d b a c k e n d - s p e c i f i c f u n c t i o n a l i t y ● D e f i n e d b y c o n t r i b m o d u l e s ● U s i n g m o d u l e s c h e c k f o r s u p p o r t ● C r e a t i o n : N o c o d e , j u s t d o c u m e n t a t i o n ● E . g . : f a c e t s , M L T , a u t o c o m p l e t e , s p e l l c h e c k

  16. D a t a t y p e ● L e t b a c k e n d s s u p p o r t n o n - d e f a u l t d a t a t y p e s ● E . g . , l o c a t i o n c o o r d i n a t e s , s p e c i a l t e x t f o r m a t s ● B a c k e n d s s t a t e s u p p o r t s i m i l a r t o f e a t u r e s ● P r o v i d e d a s p l u g i n s ● D o c u m e n t a t i o n i m p o r t a n t

  17. D a t a s o u r c e ● S u p p o r t f o r c u s t o m i t e m t y p e s /** * @SearchApiDatasource( * id = "MODULE_my_datasource", * name = @Translation("My datasource"), * description = @Translation("My great type.") * ) */ class MyDatasource extends DatasourcePluginBase { function getPropertyDefinitions() {} function loadMultiple($ids) {} function getItemId($item) {} function getItemIds() {} // … }

  18. D a t a s o u r c e ● A l s o a v a i l a b l e : ● C o n f i g u r a t i o n f o r m ● V i e w i n g a n d v i e w m o d e s ● G e t i t e m ' s I D , l a b e l , U R L search_api_track_item_*() ! ● C a l l

  19. T r a c k e r ● C h a n g e t r a c k i n g i m p l e m e n t a t i o n /** * @SearchApiTracker( * id = "MODULE_my_tracker", * name = @Translation("My tracker"), * description = @Translation("It tracks.") * ) */ class MyTracker extends TrackerPluginBase { function trackItemsInserted($ids) {} function getRemainingItems($limit, $datasource) {} function getTotalItemsCount() {} // … }

  20. T r a c k e r ● U s u a l l y d e f a u l t t r a c k e r w i l l s u f f i c e ● C a n a l s o h a v e a c o n f i g u r a t i o n f o r m

  21. P r o c e s s o r ● P r e - / p o s t p r o c e s s i n d e x e d i t e m s a n d r e s u l t s /** * @SearchApiProcessor( * id = "MODULE_my_processor", * label = @Translation("My processor"), * description = @Translation("Does stuff."), * stages = { * "preprocess_query" = 0 * } * ) */ class MyProcessor extends ProcessorPluginBase { function alterPropertyDefinitions(&$info) {} function preprocessIndexItems(&$items) {} function preprocessSearchQuery($query) {} function postprocessSearchResults(&$response, $query) {} }

  22. P r o c e s s o r ● A l s o a v a i l a b l e : ● supportsIndex() ● C o n f i g u r a t i o n f o r m ● D FieldsProcessorPluginBase e f a u l t i m p l e m e n t a t i o n ● process() , processFieldValue() , processKey() , processFilterValue() , testField() , testType()

  23. P a r s e m o d e s ● I n t e r p r e t a t i o n o f k e y w o r d s ● B y d e f a u l t : „ d i r e c t “ , „ s i n g l e t e r m “ , „ m u l t i p l e t e r m s “ ● S e l e c t i o n w h e n c r e a t i n g s e a r c h ● N o t d o n e y e t , b u t w i l l b e p l u g g a b l e

  24. Q u e r y ● D 7 : P l u g g a b l e i n o d d w a y ● D 8 : T B D

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend