Skip to content

3. Configuration

StephenGrey edited this page Nov 10, 2019 · 8 revisions

To user Sleuth as a front end to Solr, you should create a configurations file then add the name of your solr indexes to the Sleuth's database.

1. User configs

Create a file usersettings.config in the wwwsearch folder (if not present, the usersettings.config.example in the same folder will load instead)

At the minimum this folder should specify the following settings:

# -*- coding: UTF-8 -*-
#example of user settings

[Django]
secretkey: somesecretkey
#it can't cope with % charactrs in key
allowed_hosts: localhost,127.0.0.1

[Models]
collectionbasepath: /home/ubuntu/somefolder
#path to directories you want to scan

Fields recognised from the solr index can also be defined; the defaults will be loaded from solrdefaults.config but any config sections in usersettings.config will override these. A solr core named 'coreexample1' would use settings in 'defaultcore' from solrdefaults.config unless a specific instructions are given in usersettings.config

e.g.

[coreexample1]
name: defaultcore
highlightingargs: &fl=id,extract_id,extract_paths,tika_metadata_last_modified,tika_metadata_content_length,tika_metadata_resourcename&hl.fl=tika_content&hl=on&start=  
contentarguments:  
&fl=id,extract_paths,tika_metadata_date,tika_metadata_resourcename,tika_content,tika_metadata_content_length
rawtext: tika_content
docname: tika_metadata_resourcename
docpath: extract_paths
datefield: tika_metadata_date
docsize: tika_metadata_content_length
docsort: &sort+tika_metadata_resourcename+asc
datesort: &sort+tika_metadata_last_modified+desc
hashcontents: extract_id
cursorargs: &fl=id,extract_id,extract_base_type,extract_paths,extract_parent_paths&sort=id+asc&rows=100

2. Initialise database

launch the Sleuth server
go to your admin interface - e.g. http://localhost:8000/admin/
in the admin interface, (accessible to admin users only)

  • for each solr index you have, create a new object in the SolrCore table and give it a display name and its correct name (for example, 'CoreExample'), providing the connection between the frontend and the solr backend.
  • specify a usergroup for each index, create users and add them to your usergroups. (Make sure the user you want to access an index is a member of the index's usergroup)
  • create collections, which are local document folders that Sleuth can extract into the solr index. The collections are tied to a specific solrcore index, and are authorised to a specific user group.

After defining these cores, users and usergroups, if you have copied an existing index populated with documents, go directly to http://localhost:8000/ownsearch to search the index.

otherwise, go to http://localhost:8000/documents to scan your collections and extract them into the index. (accessible to admin users only)

NB: These hyper links are for local use or testing purposes. If placed on a network, you will want to install solr as a service, and deliver Sleuth via Apache, protected by SSL encryption, both of which can be easily accomplished.

Clone this wiki locally