Searching with Aptuitiv Studio - New Search Features

Oct
28
2009

We've been doing a lot of work on the search functionality of Aptuitiv Studio and I want to share some of the latest developments.

More Apps are Searchable

We recently updated Blog, Calendar and Forum to be fully searchable.  That means that whenever a new blog post, calendar event or forum post is added, edited or deleted the search index will automatically be updated. 

Know the App

When displaying search results you can now know what App and App Instance the individual result is for.  This means that you can do things like put an icon next to each search result to highlight if it's a blog post, calendar event or something else.  Below is a screen shot to give you an example of that.

Search Results with Icons

Extra Information

Another thing added to the search results is the ability to see any app-specific information.  One example of this is with our Documents app.  When a document is added to the search index the file name and the file extension is stored as well.  That means that when you're looping through the search results you can display some extra information, such as an icon, for different file types. 

Different Apps have different information that is stored.  the #result.appData} variable is where that information is stored.

Code Sample

Below is a Content Template example of displaying an icon for different apps and for different document types.

  {loop items="#results" value="result"}
      <p>
      {if #result.app == 'page'}
        <img src="/images/icons/blog_blue.png" height="16" width="16" alt="Page" />
      {elseif #result.app == 'blog'}
        <img src="/images/icons/blog.png" height="16" width="16" alt="Blog" />
      {elseif #result.app == 'calendar'}
        <img src="/images/icons/calendar_month.png" height="16" width="16" alt="Calendar" />
      {elseif #result.app == 'document'}
        {if #result.appData.fileExtension}
          {#ext|set value="{#result.appData.fileExtension}"}
          {if #ext = 'doc' || #ext = 'docx'}
            <img src="/images/icons/document_word.png" height="16" width="16" alt="Word" />
          {elseif #ext = 'pdf'}
            <img src="/images/icons/document_pdf.png" height="16" width="16" alt="PDF" />
          {elseif #ext = 'xls' || #ext = 'xlsx'}
            <img src="/images/icons/document_excel.png" height="16" width="16" alt="Excel" />
          {elseif #ext = 'ppt' || #ext = 'pptx'}
            <img src="/images/icons/document_powerpoint.png" height="16" width="16" alt="Powerpoint" />
          {elseif #ext = 'csv'}
            <img src="/images/icons/document_excel_csv.png" height="16" width="16" alt="CSV" />
          {else}
            <img src="/images/icons/document.png" height="16" width="16" alt="Document" />
          {/if}
        {else}
          <img src="/images/icons/document.png" height="16" width="16" alt="Document" />
        {/if}
      {elseif #result.app == 'forum'}
        <img src="/images/icons/sort.png" height="16" width="16" alt="Forum" />
      {elseif #result.app == 'news'}
        <img src="/images/icons/newspaper.png" height="16" width="16" alt="News" />
      {/if}
      <a href="{#result.url}">{#result.title}</a><br />
      <span>{#result.publishDate}</span><br />
      {if #result.content}
        {#result.content}
      {/if}
      </p>
  {/loop}

Leave the first comment