Configuring Tark4/GN4

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:52

Define an Exalead section in ServerConfig.xml, e.g.:

Exalead CloudView 5.1

<Exalead

  BaseCommandUrlV5="http://servername:10010/ search-api/search"

  BasePapiServerUrlV5=http://servername:10002

   ShowRefinements="true"

 />

Exalead One Enterprise 4.6

<Exalead

  BaseCommandUrl="http://servername:10000/xml/"

  BasePapiServerUrl="http://servername:10011/connectors/"

  BaseConfigServerUrl="http://servername:10011/config/"

  MaxRankedHits="1000"

  ShowRefinements="true"

  RealTimeCommit="false"

 />

Note: remember to replace servername with your real server’s name

Attributes:

BaseCommandUrl: In the Exalead product administration interface, search commands can be defined. There are many types of search commands.
The type "XML V10" (used by TARK4/GN4) corresponds to a command that accepts RequestEnvelope posts. For example, if a search command named "/xml" was added to the product configuration, then the following URL should be used for posting a:

           RequestEnvelope: http://$EXALEADHOST:$PORT/xml

           Where:

             - $HOST is the host name of the server where the product has been installed

             - $PORT is the "front" process HTTP port number

   

BasePapiServerUrl: Base path for Push API commands for version 4.6  

Defaults: http://$EXALEADHOST:$BASEPORT+11/connectors

BasePapiServerUrV5l: Base path for Push API commands for version 5.1  

Defaults: http://$EXALEADHOST:$BASEPORT+2

BaseConfigServerUrl: Base path for commands tha enable remote connectors to retrieve config set in Exalead product

Default: http://$EXALEADHOST:$BASEPORT+11/config

MaxRankedHits: The maximum number of full ranked hits returned by Exalead One Enterprise 4.6

Default: 1000

ShowRefinements: Enable or disable Exalead refinements panel in GNPortal for all users

    Default: true

RealTimeCommit: Enable or disable Realtime indexation, it means updated or newly created objects are immediately searchable (Only for Exalead One Enterprise 4.6)

This will cause a general performance slowdown. While it should be useful to keep it true in a demo environment, on the other hand in a production environment it's advisable to set it false and schedule commits (using back4 or Exalead automatic commit).

Default: false

Then define in appSettings.xml the full text engine used:

<add key="Db.FullTextEngine" value="Exalead" />

At this point, it’s possible to configure SearchUIs and Directory Styles:

    <!-- folderObjectFulltextSearch -->

    <searchObjectUI name="folderObjectFulltextSearch" title="Fulltext">

      <attribute path="FullText"/>

      <attribute path="[folderObject.name]">

        <ui>

          <template kind="ExaleadFullText"/>

        </ui>

      </attribute>

      <attribute path="[folderObject.creationDate]">

        <ui>

          <template kind="ExaleadRange"/>

        </ui>

      </attribute>

      ...

Path “fulltext” is used to search in all the index, while other indexed attributes are searchable in Exalead by setting its correspondant UI template kind.

Sorting with Exalead has some limitations:

It’s possible to sort only with 1 attribute each time, so it means that if in the directory style is specified more than 1 attribute used for sorting, only the first one will be used and the others will be ignored.

Exalead provides native support for sorting only with dates or integers. Sorting with strings it’s still possible, but it needs custom development in Exalead in order to compute the string attribute value into its correspondent integer value.

e.g.:

  <DirectoryStyleList>

    <DirectoryStyle Name="List" Height="1" Width="-1" >

      <SortList>

        <Sort Name="Rank">

          <SortDescription PropertyName="Rank" IsAscending="false"/>

        </Sort>

        <Sort Name="Name">

          <SortDescription PropertyName="[folderObject.name]" IsAscending="true"/>

          <SortDescription PropertyName="[folderObject.slugline]" IsAscending="true"/>

        </Sort>

        ...

 

First sort will sort results by rank (Note: sorting by rank it’s always descending)

In second case, sorting by name will work only if the attribute name is indexed as a field (slugline will be ignored). “Name” is a string so in order to sort it correctly it’s needed to create a new custom integer field in Exalead (since it’s possible to sort only with integers and dates) with the computed value of the string as it follows (only for Exalead One 4.6):

Create the correspondent 64bit integer field with “exa” suffix (switch to expert mode in Exalead administration)

exalead010

Create Exalead custom code for Record filtering (switch to expert mode in Exalead administration) and add the following custom code

    //long max = 205891132094648;

 

    for (RecordElement elt in record) {

      String val = "";

      if(elt.value != null) {

        switch(String(elt.name).copy(tolower=true)){

          case "name":

            val = (String) elt.value;

            break;

          default :

            break;

        }

      }

      if (val.length > 40) {

         val.length(40);

      }

      val = val.copy(normalize=true, 

                      noleading=true, 

                      notrailing=true,

                      nospace=true,

                      tolower=true).replace(/[^a-z]/,"");

      int count = val.length();

      long value = 0;

      for (int i = 0; i < count && i < 10; i++){

         int exp = 9 - i;  

         value = value + ((long) ((int) val[i] - 96)) * (long) Math.pow(27,

                 (double) exp);

      }

            //value = max - value;

      switch(String(elt.name).copy(tolower=true)){

          case "name":

             doc.addSignedField("nameexa", value);

            break;

           default :

            break;

      }

 

    }

    return doc;

    

Note: this code create the correspondent integer field only for “name” attribute

exalead011

Add custom filter to all the PushAPI sources that need customization

exalead012

After these changes, index needs to be rebuilt.