Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Lucene search plugin 'out of the box'


Reply


586 Views

Avatar
inCharge

Community Member, 102 Posts

6 July 2012 at 9:58am

I am loving lucene-silverstripe-plugin (See http://www.silverstripe.org/lucene-module/ and http://code.google.com/p/lucene-silverstripe-plugin/). Many, many thanks to Darren Inwood for developing it and making it available.

This is the best solution I have found to search in Files, or to search Page fields other than Content. Also, relevance is more accurate, and can even be fine-tuned by altering relative weighting of fields. This is industrial strength search.

It was fairly easy to get it going, but there were a few gotchas. Hopefully my solutions (or better solutions) will make it into stable releases, but maybe not, so here they are:

- The main problem is that when files are added & deleted via AssetAdmin, the index isn't updated automatically. So you have to rebuild the entire index by running a batch job! This is due to the way the File & Folder classes use SQL queries instead DataObjects. So the the event handlers that are meant to update the Lucene index aren't called. If you ask me, File & Folder are not playing by the SilverStripe rules and should be brought into line, so I raised a ticket:
Folder class should use DataObjects to create & delete File records
http://open.silverstripe.org/ticket/7582

- When pages are added, changed and deleted, indexes ARE updated immediately. However, sub-classes with no fields ARE NOT indexed. There's a detailed explation and a fix here:
http://code.google.com/p/lucene-silverstripe-plugin/issues/detail?id=7

- There's a mechanism for cacheing search results, but it caused me problems, so I disabled it. Details here:
http://code.google.com/p/lucene-silverstripe-plugin/issues/detail?id=8

- Be aware that password protected pages and files (e.g. using the securefiles plugin) are shown in search results by default. If you don't want that to happen, you need to filter them out. You wouldn't want search results to include a private intranet page titled 'All IT staff except SilverStripe devs to be made redundant by Dec 2012'.