 Hey guys, welcome and good morning and thank you for joining my session today. So I'll be presenting on how to elevate search results with solar seven and first I want to go over why I wanted to present this today at triple con and to you guys to the community. The reason why is because I recently led the solar upgrade effort for a federal agency and we went from solar four to seven and then there are a lot of blockers and I felt like this is good information to share to the community. The goal for this session is for you to get insight on upgrading from solar four to seven or in general on your local laptop or on a project that you're on that's using search API solar and that's the context for this presentation. Oh yeah and my name is Bruce Dewan and I'm currently a technical advisor for a federal agency. So for this session today I'll be going over a brief introduction of myself. The use cases for this feature that I'll be presenting. Also before getting to the reason why you're probably here on how to elevate search results I'd like to briefly go over how to set up triple seven with solar seven or sorry triple nine solar seven using a land of land of setup. After that I'm going to go over to why you're here probably. So if you stick around you'll see why if you tried to get elevate working before in your local and it isn't the reason for that and then after that I'll have a link for an example you can download later whenever you want to refer back to this presentation so you can download the relevant files for yourself set up yourself and then compared to maybe the project you're working on right now and then as usual I'll open it up for questions at the very end and during the questions one thing I did not include in this slide is like other modules like search API best bets and search overrides. If you are wondering why the way I'm doing it now versus those other modules then you can ask those questions then because I did not include that in my deck. Who am I? My name is Bruce. Working for a federal agency as a tunnel advisor right now I was trained through a training program as a junior developer and a general developer and then I was fortunate to have time to study for the grandmaster or right now it's called the aquia triple certified triple expert. All right so these cases the reason why you would use the feature that I'm about to present to you today which is elevating your search results using the solar back end only basically using solar config files only and they are the first one is most important is you want absolute control of what appears at the top when you do a search and you want absolute control of that and secondly the second use case is you want control of the order of it because typically in a search page it's sorted by relevancy score when a bunch of items are indexed have the same relevancy score at the top it's I think it's ordered by the order of which is indexed by search by solar so in that way you don't really have control over it however with this feature you can if you have a bunch of boosted items you can control what's at the very top and then lastly the last use case is if you offer clients the ability to have their content appear at the top for popular search terms and those are the three top use cases for this feature. All right so I'll briefly go over um for this example how to set up triple nine with solar seven um in no way do you have to follow the way I do it but I'm just saying this is one of the ways that I got it working on my local personally and I've done it on my work laptop as well but on my local it's different and this is how I did it on my local and they are um the steps are six steps um first obviously with Lando you want to set up install triple nine and solar seven um it sounds generic but Lando makes it easy using containerization to do that um secondly you want to install the relevant search modules and of course their search api and search api solar um after getting your site ready and having all the relevant search modules installed um then you want to you know configure it configure triple site login set up the third step of uh setting up the search api server um and the search api index the fifth step um is to it's one of the important steps is to make sure your solar config set is appropriately set up that was one of the main blockers on my project um and lastly of course you want to create your search page um with views and uh prerequisites for this example is um docker installed Lando and um ID of your choice but I use vscode for my example all right so first step um is getting um pre granular um but I think it's good to know um because um at high level sometimes you want some more detail um so first step obviously um is to install triple nine and solar seven and to do that um one way you can do it is you download the zip from the triple project and then you create a folder um this is where you will be placing your solar config set later on in our example um which and then um you want to make a appropriate lando dot eml file um this will tell um what your container will be built and initiate initiated on um and I have an example of it later on in the presentation after you have your dot lando dot yml file set up you want to execute lando start to start your container from in lando and then you want to run lando composer install and that will install all the dependencies um for those that don't know composer is a package manager that um basically pulls in all the necessary packages your site needs and you specify the in composer that json all right so after that you go to your hostname in lando and to get that hostname you would execute lando info um in case you missed it after lando start initially um after that after going to your hostname you go through the typical triple setup that blue screen where you put in the language profile where just like like umami or standard um and you set up your database information and that's where you're also installing to figure your site okay um after getting triple nine and solar seven um set up using lando um you want to install um this relevant search modules which in our case are just two there's search api and search api solar search api uh gives a generic framework um for modules that um give search capabilities and then search api solar um as the name implies it gives um your site the ability to connect to a solar back end and as usual you use a composer to install those packages and then you enable on your site using uh drush en um short for enable okay after you installed the relevant modules you want to go ahead and start configuring your site to use solar um and the first step after that is to add your search api server um so to the image to your left is the search api page um to get there you would hover over if you have adventil bar you'd hover over config search metadata and then search api and then you'll see a brief overview of all of your search api servers and indices um and then after you click add server and then the image to your left you would see a um edit page and part of that edit page is selecting your solar connector um and these are provided by solar plugins um aqua provides one it's not shown there but aqua does provide one so that your site connects to their their cloud environment um solar seven um engine in their environment um typically on your local laptop it would be um just a standard solar connector and in our example uh the protocol is HTTP instead of HTTPS um host name is search solar ports 89 83 and then the solar path is forward slash um and older versions and solar four um depending on the version of solar you use it could also be blank um but as of as of right now forward slash um should be good enough and the solar core you can name it anything you want just name of your core um that you want to can um call it after you create your search api server um you would want to create your search api index and um this is basically where you tell solar what you want to index um so that later on when a user queries your site um they'll base they'll try to match their query text with what you have what you have indexed in their um and solar's index it sounds weird but um so running over again to left is the search api page um and when you click add index um you'll be able to select the entities that you want to index in this case only nodes will be indexed because we only have content indexed i mean check marks um but you can also tell solar to index other entities such as media um which is another popular use case you want to show media as well as content um and i guess files i guess and block maybe blocks um and at the very bottom you'll see which search api server you wanted to use and um in this example we're using the one we created earlier called main search index um this associates this index with that solar um back end um so this is where you select which solar back end you want to use for that index um to your right um is a tab on the index page called fields and this is where you tell it um which field is more important than the others so in this case we have a body and title field and to the to the right it's a boost by 21 points i guess and what that means is if you have two pieces of content and you search for apple and apple appears in the title for one content but if apple appears in the body field in the in another piece of content the content that has apple in the body field will be boosted up and will be more at the top um and yep that's it for the next okay the fifth step to standing yourself up locally um with solar seven uh with triple nine is um making you making sure you configure the right um config set uh this is really important because um if you don't do it you'll get a error message saying you have an incompatible solar schema and um this could this could um really uh block your efforts in upgrading solar um so unfortunately though it's easy to resolve it all you do is click the get config zip button and what that does is uh it generates a solar config set for your solar core um based on your setup that you have done and then after you generated that and you download it um you extract it in the folder you created very early in step one um that's okay if you can recall right now um but um you extract it there and then you have to rebuild uh your landlord contingent containerization or if you find it find out how which I couldn't on myself is um just restart solar um and have it apply specifically till every time you change a solar configuration file you want to restart solar set so that it applies um that's the rule of thumb um okay and lastly um we create a search page and I try I'm trying to keep it simple for this presentation so you'll see a bare bones bar tick theme search page um and to your left is you know typical view setup um before you set up what what I don't show here is before you see this the image to your left is um you can you have to select the data source of your search page um which in my case I searched the search api index that um I created and then you'll see the search page where you can alter it um and a poor note which I highlighted um at the bottom right of the left image is the cache setting you want to make sure the cache setting is search api tag based um reason being is if you update content or you add content um you'll notice that your search results might be stale after it you're like why isn't it updating however if you cache bust it and it does appear appropriately well wait yeah well sorry about that the reason being is because um you need to use this cache setting um the the maintainers of the module set to use it um what it does is it adds a cache tag to the search page so that whenever your index your solar index is updated it tells that view to update itself and the regular tag based one does not do that for you um and this was the cause of an issue on my project but we got it down um yep okay thank you all for staying with me until now now we'll get be getting into um how to elevate search results with solar seven um I think typically most I'm I think um it's hard to set up elevate like if you're on your own um with what's out there right now maybe it's just me and me looking at the community forums but um this will be relevant to you if you're if you're having a hard time setting up elevate with just the solar back in okay so this is just a highlight overview of what I'll be going over this diagram but basically um how it usually goes is a user searches in Drupal search api view um then Drupal sends that query to solar um solar has a bunch of configuration files but I'm only going to be going over three of them in green and these are the three relevant files um relevant to getting elevate to work on your local um so after your query goes to solar um it will go to the default select handler and solar config extra and then it looks at elevate the xml to elevate um the content you want and then scheme extra types comes in because um it creates a custom field type um that analyzes the incoming query text um it sounds calculated right now but I will elaborate further okay so I'll be going over the three config files in green um those are basically how to how you'll be elevating it locally and the first one the first config file is schema extra types um so this is where you start this is first where you create your custom field type um why do we create a custom field type um well because um the current field type that you'll see later is called the string and it doesn't properly filter the query text going into elevate xml um so at the very top left that's a debug output and you see that the query the queue parameter has a has a bunch of I think loosing characters um so that's actually the text that's going to that elevate is actually trying to match um but it should just be the the text the query text that you should be matching on so what this custom field type does it just analyzes the query text to properly properly filter out all the loosing characters so that the queue parameter can match with the query text of elevate the xml and then once it matches and elevate the xml um what you specify and elevate the xml will apply and that's how you elevate your content with just a slower back end um this filter you can use it I I have in a future slide I have um the example that you can download so you don't have to worry about memorizing this it's very long and um you'd have to search the solar um documentation a lot of it to understand what's going on um but yeah that's so that's why we so this is why we create a custom field type and schema extra types and this is a the version for the standard solar connector so if using if you remember back when I um presented on the solar connector in the search api server page if you're using the standard solar connector you want to use something like this for the filter for the custom field type um if you're using if you're on aquia aquia fortunately the query um there's less loosing characters um so it's less convoluted but this is an example of one you could use if you're on an aquian environment and in fact this is what I used oh yeah this is what we my project used um to enable elevate on our project so the second config file that um you want to make sure you have it appropriately set up is the solar config underscore extra the xml file and this is where it has the default search handler um the select handler so when you do a search query this is the handler that handles it initially and if you see in line 117 on the last components um those are the components that will run through the query after the the default from lines 109 and 116 um and basically you'll see on line 119 there's an elevator search component and um that's where the elevation is applying and in that elevator component you want to make sure that elevator component has the custom field type you created and that's on line 181 on the query field type so query field type is just um if you want to alter how um the incoming query text matches the elevate um that's how you um do that um by default it's string so where it says on 181 where it says elevate um typically by default when you um generate a solar config set it'll be just string and string doesn't do it um so we want to make sure on 181 we use the custom field type that basically properly filters out the query text coming in from Drupal so that matches the elevate.xml and that's the most important part in solar config underscore extra um in terms of my feature or and lastly the last config file of the three is of course elevate.xml um this is where you specify which content you want to appear at the top for whatever whichever popular search query um so at the bottom right um with the image of the code in IDE um we have a query tag with a text attribute of test so what I'm saying what as the developer um we're doing here is basically saying when the user searches for tests um these specific content should be at the top and for the doc id um how it's formatted is the site hash the index miss machine name um the entity and then the NCID and lane code um in this example we are elevating nodes three and two and in the before image test two and test three at the bottom and after applying it it's at the top um and then another important aspect to know is the site hash um you really want to make sure you have the right site hash um right now the site hash solar Drupal search and solar it looks at the site hash from the state api used to be in the configuration um and to get the state site hash of your current environment you uh trash state get search api solar dot site hash um basically when you search search results is based on the configured site hash so um if your site hash is six ls zero one one instead of at the bottom right there five ks zero nine nine then um those results won't come actually appear back um if you have if you're showing the num count the search result count um as part of your project you'll see that it'll have a number but nothing appears then that's why because it's seeing content but it's not going to show it because the site hash um this is another blocker on my project um so important thing to know and of course to apply your config changes um you restart solar or you rebuild lando um if you're on aquia with their self-service that they recently launched this year um it apparently um automatically restarts it or applies it um and here's a link to where you can download the setup yourself um i believe these slides will be uh on youtube or there'll be a link later um and basically i have the lando lando file for you so you can just do lando start and then we're document on the instructions and then the appropriate solar config set of what's of the latest versions right now so maybe in a year you might have to regenerate it um and that's about it um any questions thank you for your attention yes um so um there's a federal site where um the documents are really important and professionals rely on them and um there's a lot of media files um and there are many uses cases where the business customers they want a particular pdf to to be up top for those business customers or for the taxpayer sorry oh was there um and um just having it the organic the organic um elevation component um didn't do it for us um all right so i'll get into for example like search over the other best bet modules so on my projects we have several search pages that use different um um indexes like different different views several views that map to different indices um and we want absolute control of it um and we didn't choose search overrides because search overrides module doesn't support multiple indices it only supports one so if you want to elevate you can only elevate one search indices for one search page versus several and then search api best bets um oh yeah sorry search api best bets it doesn't give you let you control the order of it of the top results and that's what that's why we didn't use that um i think i might have digressed in your questions but um is there anything i'm missing um oh good sweet thank you any other questions that's a good question i might have this hill back to you on that yeah uh you can message me message me on lengthen and then um i'll look into it i honestly don't know right now that's a good question though i was like let's say you have like a micro uh uh gotcha um no there's a good questions oh well i can't say from what your question right now is you can differentiate by index so if i'm understanding your question correctly okay so same index okay but by the subject or category gotcha uh here for that for is there a way to oh yeah that's a good question um yeah so yet unfortunately as of right now the only way um my understanding right now is look at the solar back end but after you're getting the site hash um the name of your machine name um entity in that format um and then plug in elevate that's the only way i see if getting your oh yeah the doc id so yeah this is something that you just you just have to know um from looking at the solar back end but from the Drupal side i know you can look at files from the Drupal side but this thought yeah yeah yeah you definitely do that yep oh right okay so when Drupal in so when Drupal indexes your contents it indexes the length code if you have your uh if you have multilingual unable um trans i find translations the name of that mod i forgot it but um um um so when Drupal indexes your your multilingual content it um indexes the length code of it and then um when you search in a multilingual site like let's say slash korean or yes so like slash ko or something like that um it will only result return the the length code uh the the doc id's with the length code um with that with that length code so in this slide right here on the bottom right you'll see that en is at the bottom right there um so if you're and if you're using um english um it'll return that however you can add two more you can add the same um two doc two doc id's below there and change it to korean um at the very end instead of uh colon en you put colon ko and then you're on your search with the slash ko um path alias um it'll return it will only elevate for those two on that particular oh i got you yeah unfortunately you have to um put that other language the way it is in there um so if you have um file the the term file in korean in the korean character um you have to put it in the text right there yes yep yep sorry for uh yep do the do the ajax um search no but did you get the um the the error from uh dev tools gotcha yeah um could you message me on linkedin um that particular issue and then i'll get back but i haven't ran into it all right any more questions yes yes initially yes but i got it to work and then i that specific landl file i put in the example um oh yeah so one of the gotchas before i got it to work was um how to have the how to get how for it to read the proper config set um but that's in there um and then one of the steps earlier it says to create a folder um within your uh within your your dribble landl folder where you'll store your config set um that path is in the landl file and um that's the only gotcha i would say any more questions oh yeah yeah when you initially when you initiate uh when you do landl start um it'll give you the host name of your site but also the host name of your search server and then yep yep and then solar admin ui should just pop up in your browser yeah i can't do that right now but um yep yep yep yeah definitely sorry about that guys all right any more questions sweet well oh right yeah yeah i think on like small to medium sized sites like in terms of content yeah that'll be that's advice but like in like very large sites where you boost a bunch and you have multiple producers boosting at the same time um that can get um complicated in terms of exactly what you want at the very top and that's where this comes in oh it's uh i don't know for sure but from the looks of it it seems like it's following the you know like the sprint points like three five seven if i'm not sure there you go there you go thank you but that's just my guess i don't know but that's just my guess sorry about that any more questions if not thank you everyone for your time um this is my first time speaking so thank you for being my first audience thank you