7

We have a setup where it is required to have different solr collections (based on language with different analyzers/tokenizers). Basically, content from a french publication, needs to be stored in the french collection, content from an english publication in the english collection, ...

Is there a way in SI4T to do this without configuring the storage config file with a different storage element (and thus a different solr url) for each publication? The broker database is the same for each publication, so this would be the only reason why we would change this configuration file when launching a new publication.

I have done this in the past in a custom implementation (before SI4T was launched) where the language was stored in the publication properties, passed together with the searchable content and then added to the solr base url to get the correct collection.

In general, how does SI4T handle multiple languages that require different fields with different analyzers?

6

Indeed you can have different cores per publication, without different storage elements. The example config file illustrates this:

<Indexer Class="org.si4t.solr.SolrIndexer" 
    DefaultCoreUrl="http://localhost:8080/solr/staging" 
    Mode="http" 
    DocExtensions="pdf,docx,doc,xls,xlsx,pptx,ppt">
    <Urls>
        <!-- SI4T: The Value attribute is the complete URL to a Solr Core
             The Id attribute denotes a unique Tridion Publication Id -->
        <Url Value="http://localhost:8080/solr/staging_pub5" Id="5" />
        <Url Value="http://localhost:8080/solr/staging" Id="8" />
        <Url Value="http://localhost:8080/solr/staging" Id="12" />
    </Urls>
</Indexer>

If you had a fixed set of collections/cores and don't want to configure this on a publication by publication basis, you could implement your own custom logic to map publications to cores in an extended SolrIndexer.

  • OK, thanks Will. But this still requires a change in this config file when a new publication is launched. I was hoping there was a way so the customer could do it without any IT intervention. – Kenneth Jan 21 '16 at 7:58
  • You will most probably need IT intervention to set up a new collection/core in Solr, so is this a big deal? – Will Price Jan 21 '16 at 9:13
  • 1
    But if it is, or if you have a fixed set of collections/cores, then you could just extend the logic in the SolrIndexer to read some custom configuration/logic you put in yourself: github.com/SI4T/Solr/blob/master/src/main/java/org/si4t/solr/… – Will Price Jan 21 '16 at 9:19
  • Or - if you only can have one core, you'd need to configure Solr's schema.xml to have an extra field for the language, and several for different tokenizers for the same content. If you go this route, you'd need to have a custom SolrIndexer to place content in the right fields as Will says, or you could modify the TBBs to do this as well. – Raimond Jan 21 '16 at 10:43
  • Thanks guys @Will, we have indeed a fixed set of collections (1 per language) – Kenneth Jan 21 '16 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.