Custom Search using Search API and Views - Drupal 8

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
recently I went through a tutorial on how to kind of modify search results and I discovered that although there's a built-in search module Drupal 8 that you can enable it's still not 100% custom search you can kind of create one with views like I have here and it does a decent job but the truth is the search is still not really querying the the content on your Drupal site Estoril as it could be so we're going to look at what's called search api and it used to be two separate modules here there was search api and search api database but during the project they said nope we're going to put it into one at least in the case for Drupal 8 and there is more to go beyond this but we're going to cover just the basis so what we're going to do is going to go to extend and I already did this step but if you don't know how and what you see here is what's called module filter and is you right click the link copy link address and then you go through the install module process and then enable it but it's going to error on me because I already technically have it enabled or sorry installed now one side note here so as I search for the search I already have enabled Search API the one thing is you want to uninstall the this default search so we go to uninstall because they can conflict it will cause slight performance issues according to Drupal report so we're going to go to install real quick and the pitting on the speed of the website okay so now we're going to check box and uninstall it gives you this which case I'm going to say yes all right so now we're going to make sure search Apes I'm under the wrong spot list I do kind of wish there was a button just on this previous screen somehow uninstall click and it does a bed anyways that's me search and so this will already apparently did so I check the one checkbox the Search API database search defaults helps in this process quite frankly and the database search and then you click install and wait again alright so those are now installed so where we go from here is we go to configuration and ignore that come down here and if you if you have a long list of configurations just do a browser search there we go Search API want to click on that and it creates oops somehow it creates two things creates a database server and then it creates an index to that server it somehow didn't connect a tube but will connect to here in a moment so here we have this database server we're going to look at actually it's best to click Edit the edit tap right here and so there's the name that it's enabled some sort of description to help you this way if you have more than one running on your site for some reason and then minimum word length B because there's advanced features be careful because on large sites this will drag it a little bit more you probably want something like Apache Solr for that and so because this one is not attached we're going to look at we're going to edit this content index and as we go through there's a lot you could tell this to index comments content message really depends on the site here I have a lot of different things running on this site but I'm going to leave it to content and here because I didn't didn't catch it so we can collect database server there's even more here you could tell to search everything except whatever you choose down here or in the term of bundles I actually I'm just going to leave it all although in this site the only thing that really has honest content this video until I build some lessons but that's a project thing and down here and index options are some more options here where you can say I wanted to actually index immediately there's a read holding which I'm not sure about so there's probably more information the documentation here on the Search API project page but I'm going to move on from now so click save and that looks about right another thing you can do is there's this fields tab and this is pretty like I mean stellar you can customize this thing like crazy I'm not joking search the rendered item the title when it was authored on change publish so forth whatever you want available to be indexed you can go through add the fields and do that which is really cool giving people really fine-tune search experience I've used WordPress for a long time and even getting this on WordPress is a bit of a pain so the fact that I could do something like this on triple and tell it hey this is how my search works is actually pretty awesome so to make sure it's actually indexing is a it's I need to enable it and now it's going to come up with a screen which case it just tells me one more time kind of how it's all set up and we do well to attract some reason to do tracking so we're going to give it a moment there we go now it's tracking now we do index depending on how many items is being on the site 50 is good if you increase this number sometimes on some house it will trigger as a DDoS attack so you want to keep the item query batches as low as possible here I've over a thousand video so this is going to take a moment now that's complete so the next thing we're going to do is we're going to create the views that outputs the results of this custom search now so we go to structure down to views and I'm going to make sure because I know I had another search thing going on here before I'm going to leave those so I'm going to create a new view that's because I use the default search before and just going to call it search and watch just her phone okay and so here's the critical part we go to the videos show this view show don't always the showing and index default content index it has a weird naming scheme but that was the name that I called it and it's should be working create page and save and edit Oh it's it's supposed to switch it's not possible of type is supposed to show something else be right back so what I had to do is add to go through and make sure I completely uninstalled all the search elite and then reinstall it and so now we're going to continue because I just did a visual test and it looks like it's going to work and so we do an ad view and what your pulse to see this time is we're going to do just call it search because I did clear it up search to encase and when you choose index default content index you should only see this sorted by unsorted nothing else or us it does break and I'll just keep the path that for now and save and edit you get customized for your site needs so now we're finally at this step so here is where you can customize the layout so here we have title and I don't really have body but I have videos so I'm going to do oh maybe just do that well depending on how your content works so you wanting to do content data source and this is where choosing the fields helps so as I go down there's my video in bed so I can do that and you know what for now that's okay this is just for testing purposes and so we want to do filter and there's full text this way it goes through both titles body everything you setup in the fields area so you expose this so people can use it and of course call it something user friendly so like search and apply and let's just look at my notes and the other one is setting it so it's just stuff that's published sorry they move things around and publishing status just helps that way you know you're only grabbing ones that are public so true and this one doesn't need to be exposed unless it's for administration and then for sort you want to use something like relevance that way is what they're looking for and descending and then apply on over here we want to do is expose the form so yes and setting make sure it says search if you want allow people to sort you'd leave that checked and then for no results behavior some sort of text or whatever you want to use so it's a soup sorry nothing here try again insert 25 cents haha ok anyways and then save now since I've exposed it to block I would want to place it somewhere so we're going to do structure and block layout and then I because I'm using bootstrap I'll just put it in the top bar area that way is pretty obvious where it is so search underscore page to place block and because I was and we don't need to show the title and because I have this other one here I want to make that one disappear from a previous search function it created and there we go so now if I go to bite website to the front end of this as soon as it loads now here's my little new search bar so I'm going to try this since I know science pages oh wait somehow loaded a pre-loaded there we go okay so now we're going to try it here and it should pull up aha and so time presents okay so maybe art so right now what it's doing is I think it's more searching the titles because I had to reinstall the modules I forgot to tell it to index so if you're not seeing the search results come back to here go back to your index and tell it to index there we go or else that's going to wait till whenever you do Chrome again so now we're going to wait so now with that index I should actually see search results so I'm going to go back to my site which takes it back to where it was and if it doesn't work after this I'm going to have to see why there we go and so here's all the videos would be the dog now because this is searching literally the title and these videos though I don't do descriptions this will make this search very hard I will probably have in my case I'll have to extend it so it actually looks like keywords as well because I do know yeah so like there is art but you get the idea so if I do budget I didn't even pull up it's going to be very meticulous I mean I guess I could search the letter B and be more specific and M the neat thing about this Oh where's the there is the quick edit I can edit this view and make it somatic so I can make it fit whatever my theme is in this case of bootstrap so I do grid because there's no boots crap bootstrap grade yet automatic with because it messes it up uncheck those and then it's three six nine twelve so call because it's four columns call em d3 if you did three columns call em before and then row and then apply and I want to rearrange this and this title sorry I'm just playing quick styling this way it looks pretty as we look at it I remove default classes where I need to okay say enough playing around so there you go and now it's a bit prettier and it works this it's I think it's pretty stellar the Search API I believe on the last release they did release notes on that was a bit cautionary I think they're getting close so like they're saying well there's no major bugs at the moment it's not completely stable and should only be used great care and production environment so they're still working out some kinks there could be some changes but I've been loving the changes so far especially the new fields interface everything I would really take take some time look at this today it really I think it's a really good game changer for Drupal Search API especially since you can really customize this according to whatever client or site building needs you have so thank you for watching please like this video if it's on YouTube subscribe share thanks again have a good day
Info
Channel: Sweet Honeycode
Views: 19,366
Rating: 4.6767678 out of 5
Keywords: Drupal, Drupal 8
Id: OoMZPU4EGrU
Channel Id: undefined
Length: 16min 47sec (1007 seconds)
Published: Tue Jan 03 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.