Theme Editor Reference Archives - SearchStax Docs Documentation Fri, 20 Oct 2023 20:31:04 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.2 https://www.searchstax.com/docs/wp-content/uploads/2023/10/cropped-favicon-32x32.png Theme Editor Reference Archives - SearchStax Docs 32 32 Variables and Functions https://www.searchstax.com/docs/searchstudio/searchstax-studio-theme-variables-and-functions/ Thu, 23 Sep 2021 16:00:16 +0000 https://www.searchstax.com/docs/?post_type=site_search&p=9645 SearchStax Studio Theme Editor Variables and Functions Theme Editor is deprecated! Theme Editor will no longer be supported after November 30, 2023. We encourage you to view our other Search… Continue reading Variables and Functions

The post Variables and Functions appeared first on SearchStax Docs.

]]>
SearchStax Studio Theme Editor Variables and Functions

Theme Editor is deprecated!

Theme Editor will no longer be supported after November 30, 2023. We encourage you to view our other Search UI options.

The SearchStax Studio Theme Editor uses the Vue.js library to manage the appearance and behavior of the theme’s Hosted Search Page. You can edit the search page HTML and CSS in the Theme Editor, and let your stakeholders see the results at the Hosted Page URL.

The Theme Editor exposes a variety of variables and functions for your use. These tools are scoped for use in individual Theme Editor templates.

Results Template Variables

The following variables are available within the Results Template.

Parameter Type Description Example
isGridLayout boolean Returns “true” if the layout is “grid.” You can use this to specify a different CSS for “grid” layout vs “list” layout. true
ribbon string Data for the mapped “ribbon” field as returned by the search. Webpage
title string Data for the mapped “title” field as returned by the search. Managed <em>Solr</em> Services Pricing | SearchStax
url string Data for the mapped “url” field as returned by the search. https://www.searchstax.com/solr-as-a-service/pricing/
paths string Data for the mapped “paths” field as returned by the search. solr-as-a-service / pricing
thumbnail string Data for the mapped “thumbnail” field as returned by the search.
date string Data for the mapped “date” field as returned by the search. August 30, 2021
snippet string Data for the mapped “snippet” field as returned by the search.
result string Object containing all unparsed result data for more complex implementations. { “paths”: “solr-as-a-service / pricing”, “content”: “Rely on a highly available, secure <em>Solr</em> infrastructure. Create world-class search experiences. Non-production Environments, prototyping, or small… applications. <em>Solr</em> Operations and Expertise as an Extension of your Team. For Companies Building Products/Apps with Embedded <em>Solr</em> for their Customer Base. * Gold… , Aliases and any custom JARs. Store your backups in another region of added security.. SearchStax supports Managed <em>Solr</em> deployments in Virtual Private Clouds”, “meta_keywords_facet”: “solr cloud hosting… solr hosting… hosted solr… hosted apache solr… apache solr… solr cloud… solr monitoring”, “url”: “https://www.searchstax.com/solr-as-a-service/pricing/”, “content_type”: “Webpage”, “title”: “Managed Solr Services Pricing | SearchStax”, “[elevated]”: true }
promoted boolean Flag if the search result is promoted (true/false). false

Facets Template Functions/Variables

The following variables are available within the Facets Template.

Parameter Type Description Example
showMobileSideMenu boolean Determines if mobile facet choosing overlay is visible. false
facet_qs array Array of selected facets passed through query params. Used to select facets on reload. It gets auto-filled when selecting a facet. [ “content_type:\”Blog\”” ]
clearFilters function Function that clears selected facets. <div @click=“clearFilters” > Clear <div>
closeSideMenu function Function that sets showMobileSideMenu to false. <div @click=“closeSideMenu” > Close <div>
computedFacets array Array of facets used as an iterator. <div v-for=”(facet, index) in computedFacets” :key=”index”>
cleanValue function
  • For strings – changes ‘_’ to spaces.
  • For undefined – returns as empty string.
  • For array – joins each value with ‘, ‘ and replaces ‘_’ with spaces for each value.
{{ cleanValue(getFieldValue(facet.facet_name, row.label)) }}
getFieldValue function Function that extracts value based on field_formatters. {{ cleanValue(getFieldValue(facet.facet_name, row.label)) }}
doMoreFacets function Function that accepts index of facet section that needs to be expanded. <div @click=“doMoreFacets” > More <div>
doLessFacets function Function that accepts index of facet section that needs to be collapsed. <div @click=“doLessFacets” > Less <div>

Results Summary Variables

These variables are available in the Results Summary editor.

Parameter Type Description Example
hasResults boolean Determines if search had any results. true
searchStore.searchFired boolean True when search was executed. true
searchStore.startDoc number Index of first item on the page relevant to all search results. 1
searchStore.endDoc number Index of last item on the page relevant to all search results. 10
searchStore.totalResults number Number of all results found. 47
searchStore.searchTerm string Searched term. solr

Empty Results Functions/Variables

The following variables are available for the Empty Results template.

Parameter Type Description Example
searchStore.searchFired boolean True when search was executed. true
hasResults boolean Determines if search had any results. false
searchStore.searchTerm string Searched term. solar
hasSpellingSuggestion boolean Determines if there are spelling suggestions. false
searchStore.spellingSuggestion string Text of a spelling suggestion. solr
onSpellingSuggestionClick function Trigger spelling suggestion click and search. <a href=”#” @click=”onSpellingSuggestionClick” >{{ searchStore.spellingSuggestion }}</a>

Search Box Functions/Variables

The following variables are available in the Search Box template.

Parameter Type Description Example
autoSuggest boolean Determines if auto suggest is turned on. true
storeState.studioConfig.hideBranding boolean Determines if branding should be shown. true
storeState.searchTerm string Searched term. solr
storeState.searchSuggestions array Array of suggestions. [ { “data”: [“<b>sea</b>rchstudio”, “<b>sea</b>rch configuration”, “<b>sea</b>rchstax”1}]
onSuggestionInputChange function Updates storeState.searchSuggestions when new input is typed into the search field. @input=”onSuggestionInputChange”
onSuggestionClick function Triggers search for a suggestion. @keyup.enter.prevent=”onSuggestionClick”
suggestion.item string A suggestion item. <template slot-scope=”{ suggestion }”> <div v-html=”suggestion.item” /> </template>
searchWithNoAutoSuggest function Should be called when autosuggest not enabled. @change=”searchWithNoAutoSuggest”
SearchHelper.search function Trigger search. <button type=”submit” @click=”SearchHelper.search”> Search </button>

Result Options Functions/Variables

These variables are available in the Result Options template.

Parameter Type Description Example
searchStore.searchFired boolean True when search was executed. true
hasResults boolean Determines if search had any results. true
searchStore.viewDisplay string Either of these values ‘multi’ | ‘grid’. true
searchStore.layoutGrid boolean Determines if grid layout. true
layoutStyle function Toggles layout style. {{layoutStyle()}}
hasMostRecent boolean Determines if date is mapped and sort by can be displayed. true
searchStore.sort_method.selected string Selected sort method. date desc
SearchHelper.search function Triggers search. <button type=”submit” @click=”SearchHelper.search”> Search </button>
searchStore.sort_method.options array Array of sort options. [ { “key”: “”, “value”: “Relevance” }, { “value”: “Newest Content”, “key”: “date desc” }, { “value”: “Oldest Content”, “key”: “date asc” } ]

Result Pagination Variables

These variables are available in the Result Pagination Template.

Parameter Type Description Example
searchStore.loading boolean Determines if search in progress. true
searchStore.startDoc number Index of first item on the page relevant to all search results. 1
searchStore.endDoc number Index of last item on the page relevant to all search results. 10
searchStore.totalResults number Number of all results found. 1703

Questions?

Do not hesitate to contact the SearchStax Support Desk.

The post Variables and Functions appeared first on SearchStax Docs.

]]>
Example Theme https://www.searchstax.com/docs/searchstudio/searchstax-studio-example-theme/ Wed, 08 Sep 2021 18:09:25 +0000 https://www.searchstax.com/docs/?post_type=site_search&p=9646 Theme Editor Walk-through Example Theme Editor is deprecated! Theme Editor will no longer be supported after November 30, 2023. We encourage you to view our other Search UI options. SearchStax… Continue reading Example Theme

The post Example Theme appeared first on SearchStax Docs.

]]>
Theme Editor Walk-through Example

Theme Editor is deprecated!

Theme Editor will no longer be supported after November 30, 2023. We encourage you to view our other Search UI options.

SearchStax offers out-of-the box themes that can be applied to your Search App. But what if you already have a theme in mind and want to edit the page yourself with minimal effort? This is now possible with the Theme Editor provided inside the SearchStax Studio.

The following post is a walk-through on how you can create your own theme using the default Citrine theme as a base.

(This post assumes that you have already have a Search App up and running.)

What are we making?

We have a Search App ready with data already indexed. The data consists of the following fields:

  • id
  • street_address
  • zip_code
  • state
  • title
  • rooms
  • image
  • description

This is the Citrine theme applied by the Studio as default on our application when we view the Hosted Search App page.

We propose to add some spice to the above theme to make it look like:

We will be using the Theme Editor provided by SearchStax.

How to Customize the Base Theme?

First, make a Copy of Citrine. We’ll make our changes in the copy.

This step is crucial because the default themes in the Studio are protected and cannot be changed. We will name our theme “Travel” and click on Duplicate to replicate the base theme.

Make a checklist of the differences between our theme and the Citrine theme:

  • Citrine has a toggle button to switch between grid view and list view, but our theme only has a grid view. So, remove the toggle button.
  • Our theme has an additional banner at the top. Add the banner.
  • Customize the search box to make it look like our design by changing the icons.
  • Our theme doesn’t use faceted search. Remove Facets.
  • Give a new look to the result cards and display only the information we need.

Click on the Settings icon (). It will open the Theme Settings Editor. Click Full Results. Look for the Single View Stule “Grid” option and select it. Click Save to update the changes to our theme.

If you want to see the changes just click on the Search icon in the input box and you will only see the grid option. The toggle switch (List vs Grid) will no longer be there.

If you want to see the changes on the actual page, click on Publish button and it will give you a link to the Hosted Page App where you can see all the changes you make during this post. (Note that a Search App may have only one published theme at a time.)

To remove the Facets, click on the Layout tab. This opens the HTML and CSS code for the page layout. Here we can see that the page is divided into different sections. Each section in the Layout tab is a wrapper around the text you see on the result page. Since, we do not need the facets for our design we can remove the facet-container-wrapper. Click on Save to see the changes.

The next change we need to do is to add the banner to our web page. As mentioned above, the Layout tab contains the skeleton of the app. Hence, we can add a div here to add the banner to our application.

<!-- Add this above the 
search-input-wrappr div -->

<div class="banner">
</div>
//Add this to the CSS
.banner{
  height: 20vh;
   background: #1A385A;
}

We can see the banner once we click Save.

To remove the Feedback button, simply remove the feedback-wrapper div.

Now, let’s move the Search box above and style it to look like our design.

Search box has a class search-input-wrapper. Once we look that class up in the CSS tab, we can change the margin-top property from 20px to -30px to move it up in the y-direction.

We now have something close to what we want, but we still need to remove the background from the search box.

One of the most useful feature of the Theme Editor is that if we want to edit a component we can simply hover over that component and click on the Edit button to style it.

To style the Search box, hover on it and click the Edit button. This will open up the corresponding Search Box HTML and CSS editors to the right.

This section shows how to change the placeholder text and how to remove the background images from the Search box. The HTML sections have distinct identifiers that match the CSS classes to make editing easy.

Once we make the above changes, we now have a page that looks close enough to our design.

Note: The background images are base64 encoded. If you want to replace the icons with your own icons, you can convert your images to base64 and place it in the CSS as shown below. Here is a useful link that can help convert images to base64: https://www.base64-image.de/

Edit Search Result Cards

Hover over the result section and click the edit button to view the Result Itmes HTML and Result Items Style editors.

In order to edit the result section we first need to understand the bindings so that we can map the data to our design. Refer to the fields described above in this post. These fields are returned by the SearchStax Search API and we can access them using the result keyword. So, if we want to access the title we can simply get the value by doing: result.title, for description: result.description, for image: result.image, and so on.

Now, if we look at the default card bindings we actually do not need all the code and can simply use the above method to use what we require. So first, remove all the marked Vue bindings.

Our card can be analyzed into the following result components:

So, we can edit the HTML as follows:

<div class="card-searchstudio-js-custom" :class="{'card-searchstudio-js-grid-layout': isGridLayout, 'has-thumbnail': thumbnail !== ''}">
    <div class="result-header">
        <img class="result-image" :src="result.image" alt="place">
        <div class="card-searchstudio-js-title bottom-left" v-if="title">
            <a class="stretched-link" v-if="url" :href="url" @click="navigate" v-html="title" />
            <span class="result-title" v-else v-html="title" />
        </div>
    </div>
    <div class="card-searchstudio-jsClass">
        <div class="card-searchstudio-js-body p-0 result-info">
            <div class="card-searchstudio-js-body p-0">
                <div>
                    <p class="truncate"> {{ result.description }} </p>
                    <p class="bottom-left"> <span> $ {{ result.price }} </span> &nbsp;&nbsp;&nbsp; <span> {{ result.rooms}} room(s) </span> </p>
                    <button class="result-btn">View Details</button>
                </div>
            </div>
        </div>
    </div>
</div>

The corresponding CSS changes:

.result-image{
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.result-info{
  padding: 20px !important;
}
.result-title{
  font-size: 16px;
  font-weight: 400;
}
.result-header{
  position: relative;
  text-align: center;
  color: white;
}
.bottom-left{
  position: absolute;
  bottom: 0px;
  left: 20px;
}
.truncate{
    overflow: hidden;
    line-height: 1.2rem;
    max-height: 8rem;
    -webkit-box-orient: vertical;
    display: block;
    display: -webkit-box;
    overflow: hidden !important;
    text-overflow: ellipsis;
    -webkit-line-clamp: 4;
}
.result-btn{
  padding: 12px 20px;
    position: absolute;
    right: 20px;
    bottom: 10px;
    border: none;
    cursor: pointer;
    background: #1A385A;
    color: #fff;
}
.card-searchstudio-js-custom {
	 position: relative;
	 //padding: 39px 12px 28px 12px;
	 color: #33475a;
	 border: none;
	 box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.14902);
}

Final Result

Once all the changes have been made, click Save and Publish to get the link to the Hosted Search Page. We can see that the theme we created is now applied to our Studio App.

Questions?

Do not hesitate to contact the SearchStax Support Desk.

The post Example Theme appeared first on SearchStax Docs.

]]>