Solr integration for Plone
ftw.solr integrates the Solr search engine with Plone.
Since version 2.0 ftw.solr no longer depends on collective.solr. Instead it provides it’s own Solr integration using Solr’s REST API. Version 2.0 is a complete rewrite and is not compatible with ftw.solr 1.x.
ftw.solr does not try to replace the portal catalog of Plone and does not hook into the catalog’s search function. Instead it provides a search utiltity that must be used explicitly. It’s meant to be used in search forms for fulltext searches while the portal catalog is still in use for things like navigation or folder contents. The goal is to get rid off all fulltext indexes (e.g. ZCTextIndex) in the portal catalog.
ftw.solr requires Apache Solr 7.0 or higher.
Add as dependency
Install ftw.solr by adding it to the list of eggs in your buildout or by adding it as a dependency of your policy package.
[instance] eggs += ftw.solr
To install a Solr server with buildout you can use the ftw.recipe.solr recipe.
[solr] recipe = ftw.recipe.solr cores = mycore
Configure the Solr connection
The connections settings for Solr can be configured in ZCML and thus in buildout. Example:
[instance] zcml-additional = <configure xmlns:solr="http://namespaces.plone.org/solr"> <solr:connection host="localhost" port="8983" base="/solr/mycore"/> </configure>
After running buildout and restarting your instance you can install the ftw.solr addon in Plone.
Get the ISolrSearch utility and call the search method to get search results from Solr.
from ftw.solr.interfaces import ISolrSearch from zope.component import getUtility solr = getUtility(ISolrSearch) resp = solr.search(query=u'SearchableText:foo')
You can get a plone.app.contentlisting style result by adapting IContentListing:
from plone.app.contentlisting.interfaces import IContentListing listing = IContentListing(resp)
This package is copyright by 4teamwork.
ftw.solr is licensed under GNU General Public License, version 2.
- Perform soft commits and wait for new searcher by default to allow near real time (NRT) searching. [buchi]
- Additionaly index metadata of files using an update command to make them visible as soon as possible. [buchi]
- Flush optimize command. [buchi]
- Add support for indexing path depth. [buchi]
- Fix partial reindexing (atomic updates) for fields without a value. [buchi]
- Fix reindexObjectSecurity patch to account for special handling of system roles in allowedRolesAndUsers indexer. [lgraf]
- Patch reindexObjectSecurity to optimize indexing of large trees. [lgraf]
- Fix diff for items with a modification date that has no fractional seconds. [buchi]
- Provide an error message when raising an AttributeError in SolrDocument. [buchi]
- Add option to synchronize Solr with catalog in maintenance view. [buchi]
- Set Content-Type ‘application/x-www-form-urlencoded’ for requests to /update/extract endpoint to ensure compatibility with Solr 7.3. [lgraf]
- Maintenance view: Allow reindexing without dooming the transaction. [lgraf]
- Make sure we do not pass invalid dates to Solr. [buchi]
- Declare dependency on plone.namedfile[blobs]. [lgraf]
- Add diff function to maintenance view to compare UIDs in portal catalog with UIDs in Solr. [buchi]
- Fix security filter: Properly quote roles/users with spaces. [buchi]
- Add option to reindex Solr from a catalog query. [buchi]
- Complete rewrite. Not compatible with previous versions. [buchi]