Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vancouver PHP Meetup

Elastic Co
December 06, 2017

Vancouver PHP Meetup

Talk given for PHP UG Meetup in Vancouver: https://www.meetup.com/Vancouver-PHP/events/244968394/

Elastic Co

December 06, 2017
Tweet

More Decks by Elastic Co

Other Decks in Technology

Transcript

  1. 10

  2. Some data CREATE TABLE user ( name VARCHAR(100), comments VARCHAR(1000)

    ); INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 11
  3. Search on term SELECT * FROM user WHERE name="David"; Empty

    set (0,00 sec) 12 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  4. Search like SELECT * FROM user WHERE name LIKE "%David%";

    +--------------+----------------------+ | name | comments | +--------------+----------------------+ | David Pilato | Developer at elastic | | David Gageot | Engineer at Google | | David David | Who is that guy? | +--------------+----------------------+ 13 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  5. Search in two fields SELECT * FROM user WHERE name

    LIKE "%David%" OR comments LIKE "%David%"; +--------------+---------------------------------------------+ | name | comments | +--------------+---------------------------------------------+ | David Pilato | Developer at elastic | | Malloum Laya | Worked with David at french customs service | | David Gageot | Engineer at Google | | David David | Who is that guy? | +--------------+---------------------------------------------+ 14 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  6. 15

  7. 16

  8. Search with typos SELECT * FROM user WHERE name LIKE

    "%Dadid%"; Empty set (0,00 sec) 17 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  9. Search with typos SELECT * FROM user WHERE name LIKE

    "%_adid%" OR name LIKE "%D_did%" OR name LIKE "%Da_id%" OR name LIKE "%Dad_d%" OR name LIKE "%Dadi_%"; +--------------+----------------------+ | David Pilato | Developer at elastic | | David Gageot | Engineer at Google | | David David | Who is that guy? | +--------------+----------------------+ 18 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  10. 19

  11. ‹#› Methionylthreonylthreonylglutaminylarginyltyrosylglutamylserylleucylphenylalanylalanylglutaminylleuc yllysylglutamylarginyllysylglutamylglycylalanylphenylalanylvalylprolylphenylalanylvalylthreonylleucylgl ycylaspartylprolylglycylisoleucylglutamylglutaminylserylleucyllysylisoleucylaspartylthreonylleucylisoleu cylglutamylalanylglycylalanylaspartylalanylleucylglutamylleucylglycylisoleucylprolylphenylalanylseryla spartylprolylleucylalanylaspartylglycylprolylthreonylisoleucylglutaminylasparaginylalanylthreonylleucyl arginylalanylphenylalanylalanylalanylglycylvalylthreonylprolylalanylglutaminylcysteinylphenylalanylglu tamylmethionylleucylalanylleucylisoleucylarginylglutaminyllysylhistidylprolylthreonylisoleucylprolylisol eucylglycylleucylleucylmethionyltyrosylalanylasparaginylleucylvalylphenylalanylasparaginyllysylglycyli soleucylaspartylglutamylphenylalanyltyrosylalanylglutaminylcysteinylglutamyllysylvalylglycylvalylaspa

    rtylserylvalylleucylvalylalanylaspartylvalylprolylvalylglutaminylglutamylserylalanylprolylphenylalanylarg inylglutaminylalanylalanylleucylarginylhistidylasparaginylvalylalanylprolylisoleucylphenylalanylisoleuc ylcysteinylprolylprolylaspartylalanylaspartylaspartylaspartylleucylleucylarginylglutaminylisoleucylalany lseryltyrosylglycylarginylglycyltyrosylthreonyltyrosylleucylleucylserylarginylalanylglycylvalylthreonylgly cylalanylglutamylasparaginylarginylalanylalanylleucylprolylleucylasparaginylhistidylleucylvalylalanylly sylleucyllysylglutamyltyrosylasparaginylalanylalanylprolylprolylleucylglutaminylglycylphenylalanylglycy lisoleucylserylalanylprolylaspartylglutaminylvalyllysylalanylalanylisoleucylaspartylalanylglycylalanylala nylglycylalanylisoleucylserylglycylserylalanylisoleucylvalyllysylisoleucylisoleucylglutamylglutaminylhist idylasparaginylisoleucylglutamylprolylglutamyllysylmethionylleucylalanylalanylleucyllysylvalylphenylal anylvalylglutaminylprolylmethionyllysylalanylalanylthreonylarginylacetylseryltyrosylserylisoleucylthreo nylserylprolylserylglutaminylphenylalanylvalylphenylalanylleucylserylserylvalyltryptophylalanylaspartyl prolylisoleucylglutamylleucylleucylasparaginylvalylcysteinylthreonylserylserylleucylglycylasparaginylgl utaminylphenylalanylglutaminylthreonylglutaminylglutaminylalanylarginylthreonylthreonylglutaminylval ylglutaminylglutaminylphenylalanylserylglutaminylvalyltryptophyllysylprolylphenylalanylprolylglutaminy
  12. 21

  13. Search for terms SELECT * FROM user WHERE name LIKE

    "%David Pilato%"; +--------------+----------------------+ | name | comments | +--------------+----------------------+ | David Pilato | Developer at elastic | +--------------+----------------------+ 22 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  14. Search with inverted terms SELECT * FROM user WHERE name

    LIKE "%Pilato David%"; Empty set (0,00 sec) SELECT * FROM user WHERE name LIKE "%Pilato%David%"; Empty set (0,00 sec) 23 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  15. Search for terms SELECT * FROM user WHERE name LIKE

    "%David%" AND name LIKE "%Pilato%"; +--------------+----------------------+ | name | comments | +--------------+----------------------+ | David Pilato | Developer at elastic | +--------------+----------------------+ 24 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  16. Synonyms SELECT * FROM user WHERE comments LIKE "%Engineer%"; +--------------+----------------------+

    | name | comments | +--------------+----------------------+ | David Gageot | Engineer at Google | +--------------+----------------------+ 26 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Google'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  17. Synonyms SELECT * FROM user WHERE comments LIKE "%Developer%" OR

    comments LIKE "%Engineer%"; +--------------+----------------------+ | name | comments | +--------------+----------------------+ | David Pilato | Developer at elastic | | David Gageot | Engineer at Google | +--------------+----------------------+ 27 INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?');
  18. Search like within 1 000 000 000 records… SELECT *

    FROM user WHERE name LIKE "%David%"; 28
  19. We need a search engine. Not a database with some

    search capabilities. David Pilato, PHP Meetup Vancouver, 05/12/2017
  20. 31

  21. 32