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

the search api in drupal 8
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

The Search API in Drupal 8

Thomas Seidl (drunken monkey)

slide-2
SLIDE 2

Disclaimer

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

slide-3
SLIDE 3
  • G

e n e r i c i n f

  • r

m a t i

  • n
  • D

a t a s

  • u

r c e s

  • F

i e l d s

  • P

r

  • c

e s s i n g

  • S

e a r c h w h a t ?

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 … F a c e t s

  • T

e c h n i c a l i m p l e m e n t a t i

  • n
  • U

s e s d a t a b a s e / S

  • l

r / …

  • S

e a r c h h

  • w

?

slide-4
SLIDE 4

S e r v e r

  • C
  • n

f i g u r a t i

  • 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

  • r
  • p

e r a t i

  • n

s

  • S

t

  • 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

slide-5
SLIDE 5

B a c k e n d

  • P

l u g i n f

  • r

s e r v e r s

  • I

m p l e m e n t a t i

  • n
  • f

s e r v e r

  • p

e r a t i

  • 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

  • n

t

  • c

h a n g e d i n d e x e s

  • C

u s t

  • m

c

  • n

f i g u r a t i

  • n

f

  • r

m

  • C
  • n

n e c t s t

  • s

t

  • r

a g e ( D B , S

  • l

r , … )

slide-6
SLIDE 6

I n d e x

  • C
  • n

f i g u r a t i

  • n

e n t i t y

  • M

a i n c

  • n

n e c t i

  • n

t

  • t

h e r m

  • d

u l e s

  • P

l u g i n s :

D a t a s

  • u

r c e s “ p r

  • 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

  • c

e s s

  • r

s “ a l t e r d a t a / w

  • r

k f l

  • w
slide-7
SLIDE 7

D a t a s

  • u

r c e

  • I

n d e x p l u g i n p r

  • v

i d i n g a s p e c i f i c k i n d

  • f

d a t a

  • E

. g . , n

  • d

e s , c

  • m

m e n t s , e x t e r n a l d a t a

  • L
  • a

d i n g , v i e w i n g , m e t a d a t a f

  • r

t y p e s

  • D

a t a s

  • u

r c e

  • s

p e c i f i c c

  • n

f i g u r a t i

  • n
slide-8
SLIDE 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

  • f

i t e m s

  • R

e a c t s t

  • 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

  • b

e i n d e x e d ?

slide-9
SLIDE 9

P r

  • c

e s s

  • 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

  • r

k f l

  • 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
  • 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

  • n

s “ )

slide-10
SLIDE 10

I n d e x i n g

D a t a s

  • u

r c e s P r

  • c

e s s

  • r

s S e r v e r I n d e x

1 . D e t e r m i n e s c h a n g e d i t e m s 2 . L

  • a

d i t e m s 5 . E x t r a c t s f i e l d s 4 . A l t e r m e t a d a t a 6 . P r e p r

  • c

e s s f i e l d s / i t e m s 3 . P r

  • v

i d e m e t a d a t a 7 . S e n d s i t e m s t

  • 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 1 . M a r k s i t e m s a s i n d e x e d

T r a c k e r

slide-11
SLIDE 11

S e a r c h i n g

Q u e r y P r

  • c

e s s

  • r

s S e r v e r S e a r c h

3 . P a r s e s k e y w

  • r

d s 1 . C r e a t e s q u e r y 6 . P r e p r

  • c

e s s q u e r y 8 . P

  • s

t p r

  • c

e s s s e a r c h r e s u l t s 4 . A d d s f i l t e r s , s

  • r

t , e t c . 7 . R e t r i e v e s r e s u l t s 5 . E x e c u t e s q u e r y 2 . A d d s k e y w

  • r

d s 9 . D i s p l a y s r e s u l t s

slide-12
SLIDE 12

C u s t

  • m

i z a t i

  • n

s

slide-13
SLIDE 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) {} }

slide-14
SLIDE 14

B a c k e n d p l u g i n

  • A

l s

  • a

v a i l a b l e :

  • C
  • n

f i g u r a t i

  • n

f

  • r

m

  • R

e a c t t

  • n

e w / c h a n g e d / r e m

  • v

e d i n d e x e s

  • C

R U D „ h

  • k

s “

  • supportsFeature(),

supportsDatatype()

slide-15
SLIDE 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

  • n

a l i t y

  • D

e f i n e d b y c

  • n

t r i b m

  • d

u l e s

  • U

s i n g m

  • d

u l e s c h e c k f

  • r

s u p p

  • r

t

  • C

r e a t i

  • n

: N

  • c
  • d

e , j u s t d

  • c

u m e n t a t i

  • n
  • E

. g . : f a c e t s , M L T , a u t

  • c
  • m

p l e t e , s p e l l c h e c k

slide-16
SLIDE 16

D a t a t y p e

  • L

e t b a c k e n d s s u p p

  • r

t n

  • n
  • d

e f a u l t d a t a t y p e s

  • E

. g . , l

  • c

a t i

  • n

c

  • r

d i n a t e s , s p e c i a l t e x t f

  • r

m a t s

  • B

a c k e n d s s t a t e s u p p

  • r

t s i m i l a r t

  • f

e a t u r e s

  • P

r

  • v

i d e d a s p l u g i n s

  • D
  • c

u m e n t a t i

  • n

i m p

  • r

t a n t

slide-17
SLIDE 17

D a t a s

  • u

r c e

  • S

u p p

  • r

t f

  • r

c u s t

  • 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() {} // … }

slide-18
SLIDE 18

D a t a s

  • u

r c e

  • A

l s

  • a

v a i l a b l e :

  • C
  • n

f i g u r a t i

  • n

f

  • r

m

  • V

i e w i n g a n d v i e w m

  • d

e s

  • G

e t i t e m ' s I D , l a b e l , U R L

  • C

a l l search_api_track_item_*()!

slide-19
SLIDE 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

  • 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() {} // … }

slide-20
SLIDE 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

  • h

a v e a c

  • n

f i g u r a t i

  • n

f

  • r

m

slide-21
SLIDE 21

P r

  • c

e s s

  • r
  • P

r e

  • /

p

  • s

t p r

  • 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) {} }

slide-22
SLIDE 22

P r

  • c

e s s

  • r
  • A

l s

  • a

v a i l a b l e :

  • supportsIndex()
  • C
  • n

f i g u r a t i

  • n

f

  • r

m

  • D

e f a u l t i m p l e m e n t a t i

  • n

FieldsProcessorPluginBase

  • process(),

processFieldValue(), processKey(), processFilterValue(), testField(), testType()

slide-23
SLIDE 23

P a r s e m

  • d

e s

  • I

n t e r p r e t a t i

  • n
  • f

k e y w

  • 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

  • n

w h e n c r e a t i n g s e a r c h

  • N
  • t

d

  • n

e y e t , b u t w i l l b e p l u g g a b l e

slide-24
SLIDE 24

Q u e r y

  • D

7 : P l u g g a b l e i n

  • d

d w a y

  • D

8 : T B D

slide-25
SLIDE 25

F u r t h e r D 8 c h a n g e s

  • S

e v e r a l d a t a s

  • u

r c e s p e r i n d e x

  • M
  • r

e q u e r y f u n c t i

  • n

a l i t y ( l i k e D B l a y e r )

  • M

a j

  • r

c h a n g e s f

  • r

p r

  • c

e s s

  • r

s

  • P
  • s

s i b l y : „ q u e r y e x t e n d e r s “ / p e r

  • q

u e r y p r

  • c

e s s

  • r

c

  • n

f i g

  • L
  • a

d s

  • f
  • t

h e r s t u f f

slide-26
SLIDE 26

General information

slide-27
SLIDE 27

T h a n k y

  • u

!

slide-28
SLIDE 28

Wh a t d

  • y
  • u

t h i n k ?

slide-29
SLIDE 29

O t h e r q u e s t i

  • n

s ?