Drupal 8 - Using Search API - Sweet Honeycode

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi we are going to look at the Search API module for Drupal 8 now there's two ways to install a module in Drupal 8 you can use the original I have a admin toolbar thing going on here you can go to extend then click on new mod install new module button and which case you can go all the way down to the bottom page and copy the link address and then paste or the other way if you have the environment set up you can use trash which case the command is trash space en as in enabled space search underscore API now one thing to keep in mind is what Drupal 8 before coming up on the horizon there might be some changes to this but this really shouldn't be a whole lot I'm going to show this method today we'll use the install from URL so now that has done I will click yes sorry using a new screen recorder so we're going to click enable newly added modules here this is why the drush method is a bit faster because it does these two steps in one command so one key thing to keep a note if you're running a fresh install of Drupal or maybe you're running a project already you want to you'll need to uninstall this default search module so what we need to do again you could use brush which is this and then search would do that or you go through here on the website and find the search which is here and clicking uninstall actually believe is instead of disk it would be p.m. - uninstall or something like that for drush so here it's removing all the blocks any search pages it's made so we'll have a clean slate alright now with that uninstall we are going to install our oops I'm on them I need to go back to list so go back to the list and now I'm going to look up our search API now there's a few things you can enable now you can enable the standard Search API there's now Search API to handle taxonomy term I like to just to get started for this tutorial we're going to do the deep search default and this one database search as well and click install now if you use the drush command these may not be installed so you want to double-check this area to follow up where I am at now that that is done we will go to configuration now I have a toolbar that makes it a little bit easier but I'm going to do it the hard way which is going to the actual configuration screen and we scroll all the way down towards the Search API and here it's already got two things set up at that of a server and an index so let's take a look at each thing real quick the first thing we have is a database server now this can be called anything you need for your project or to help you remember you can create a name a description has data basing I believe this is so that you can attach to other modules that extends the Search API here I'm just a basic site here as it's noted that this will not work if you have an extremely large site so you'll need to research for that and you can set other things like searching parts of a word but again if you're on a big site that's not good so you probably again research but you're probably going to need something like a patch a solar for anything bigger than a standard site for a database server so this is fine for what I need so I'm going to go back to the Search API page and I'm going to click Edit just to show you around here now what's the index you can practically index anything that's an entity in Drupal 8 ever Drupal 8 new thing is everything's an entity so you can search it now from comments contact messages and so forth obviously my guess is that this is to help extend other interfaces that you could be building for maybe administration soap and such so that to create a really really cool experience for your clients here you would select the server if this index is working with a different database server in this case by default it sets it up with this one it's enabled a description and index options it shows you more what if is if this is just repeated only and to whether or not to index these items immediately and how we need to do on Chrome so I do not suggest using negative one as it will index them all at once if you have a large large amount of data that's just that you want to do it in batches to help keep your server load down so here it just gives me quick summary this is everything I want it to be yes and then index now this is going to be relative to sit straight for since this is a development site with literally one post content so there's not going to be a whole bunch of oohs and ahhs here but the next thing to do here is to go to your structure views and we're going to create a new page now you could its kind of created a search content page but I'm going to show you how to make a view so we're going to do add view and I'm going to call it just search everything so I know and here under the view settings we're going to choose to do index default content index now this is the name of the index we made on the other screen so that's where that's pulling that and after quick please wait we see a sorted by and then unsorted if you do not see this and the chances are you have not completely clear the default search module so we're going to move on I'm gonna make sure there's a page for this so I didn't have something to reference we could create a block at the same time but I'm going to show you another way of doing this and we're going to save and edit now one thing that will be a side trip real quick I am going to go back to configuration page in the new tab and show you this because I forgot to visit this is there's this field now that you can use and fields is pretty incredible because it allows you to go a little deeper with the data on the website specifically what you're searching and make those things a part of this new search and Bart adds new search results thing you're creating and another thing that I haven't had a chance to touch yet but I'll show you is processors so you can have it where it adds highlights so you know I'll highlight your results and so forth so you could really look at this and play around with it like there's stop words if it's enabled there's a lot I'm not like there's a lot here it's a credibly deep but with that already saved I've already saved all that I'm going to close that tab like I really encourage you to really look around there and learn more about how that could be used for your projects and there is a documentation here on the project page that I highly recommend to go a little deeper but in my case to create a search page I'm going to go back here is now I want to do an add filter and I want full tax search so as you can see I'm going to remove a quick so I could show this ok moved a little fast there search several or all full text fields at once so this gives you some options to what to search and here's the items it's going to search it's going to search the title and render item and that's about it if I don't select an ID a field then all full text fields will be searched but it doesn't really guess if I wanted to make sure it did that I don't click anything so it's a bit that parts a bit meticulous but that's water on the bridge so I want to expose this to the person the user and to say search and apply again adjust to your needs and so the next thing next thing you want to do is make sure it's also only getting things that are published very key true and this one isn't exposed unless you're creating an administrative page where they are have ability and the next thing we want to do is the sort criteria again this is more how you want to set it up so we're going to do relevance and the sort ascending descending whatever your preference is and click apply and I'm going to just hit save to make sure I'm saving where I'm at so the next thing we're going to do is expose this form and a block this way it's easier to have this block available throughout the site so I'm going to do exposed form yes and then you have to show this again change settings to fit your needs in this case I want to place search or you can have it go I don't really need people to choose how to sort it and now that that's about everything at least on paper so now I'm going to pose this an S on to my demo site here by using blocks little structure block layout and put this in the content and we go down here exposed form search everything page one place block and I really don't need them to have a title but if I wanted to have a title you don't write it just say block I don't really need it restricted and just to make sure I'm going to do safe block again perfect so the one thing I installed off-screen was the devel module and what this I'm going to use this for is to generate some content for me real quick so I'm only doing this for myself so that I'm going to do something ten and let's be good because this is a development site which is for learning purposes this is OK for me to do so now I'm going to go visit the front page of this website and try this out now this is going to be a bit hard because of the Lauren ensign to search especially for relevance but we're going to have some fun and see how well this works so we'll type in one word and maybe it's used in the Loren Ibsen so oh and it it did now the thing is I would want to take this further and style this but it is technically working because in a nice Lauren Epson generator this Loren Ibsen word is somehow used so if I wanted to style this for my bootstrap being here I would go further to like those were titles and so I would go in here and because we're dealing with the search pad API module everything's called content datasource so through here I would choose the different things I would want to show so if there was an image show that and you know and customize it to to fit excuse me to fit the needs so I'm just really going to go through here and not do a whole lot but just kind of give a quick idea of how oh it's not doing that maybe I need to add a new title time there you go obviously would do this for whatever your here's your site theme knees range and if there's any other way you're styling this here I'm not going to stress too much but upon testing this now if I try to put in that word these should be the things that contain that word you would need to play around with it more but this is the most customized search module I've ever come across for any platform I've used thus far and I'm coming from a wordpress background this is very very impressive what it does I did use previously another project and I was just showing the more up-to-date Search API for you today I hope you liked this video hope it helped you understand more thoroughly about how to implement this again look little deeper there's a lot of things in there like that pre-processors and there's a lot more than what I showed under the hood - this cool system here so anyways thank you for watching please like and subscribe and share this and have a good day
Info
Channel: Sweet Honeycode
Views: 15,932
Rating: 4.5471697 out of 5
Keywords: Drupal 8
Id: f99pFVEFaww
Channel Id: undefined
Length: 17min 27sec (1047 seconds)
Published: Wed May 31 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.