Archive for November, 2010

Solr and Plone

Posted: 26/11/2010 in Develop
Tags: ,

Hi All,
in these mounths we are develop a Plone application with Solr search engine. Until the current release there are some common functions that doesn’t work correctly.

Intro

Ours tests are made on:

  • Plone 3.3.5 vanilla
  • Solr 1.4.1
  • collective.solr 1.0

Bugs

The first bug is related the search function, if you find more than 10 elements and try to see all pages but 1, you’ll get an error. This bug is generated by a wrong query catalog call.

The second one is very similar: if you create a content and you try to add a related item, you will get a pop-up page that shows pages to link. From the search in this pop-up, if you try to search some term, you’ll get an error.

Solutions

Fix the first bug is easy, is enought to get the number of result for page and set the value of max_result available from solr with the same value.

The second one is more complex, you have to change the following files:

  • referencebrowser_popup.pt
  • referencebrowser_queryCatalog.py

The main point is add to referencebrowser_queryCatalog.py two paramenters for batch b_start and b_size. After that you can use that variables putting them in the query variable used by catalog.

The referencebrowser_popup.pt instead needs to be change the use of the result of query catalog: collective.solr by default if find 100 results for a query returns 10 flares and 90 None objects. This is a way to speed up the elaboration of query. This choice avoid the possibility to get all objects as required by referencebrowser_popup.pt. The solution is to substitute the objects with brains (flare for solr).

If you are interested, you can download my patch to fix this problem.

Cheers.

Advertisements