cancel
Showing results for 
Search instead for 
Did you mean: 

Upgrade from 4.0d using Lucene to 4.2e using SOLR

ewan_ritchie
Champ in-the-making
Champ in-the-making
I have just updated from 4.0d with Lucene indexing to 4.2e and have enabled and configured SOLR.  Our environment is Windows Server 2008 R2.

Everything is working as expected except when searching (advanced search on a custom object model) using more than one filter criteria the results returned (many more rows than expected due to the filters being OR'd together) would suggest that the default search criteria on multiple filters is OR.  We need this to be AND.

I have updated the schema.xml (in folder \alf_data\solr\workspace-SpacesStore\conf) and added <solrQueryParser defaultOperator="AND"/> as suggested but this has not changed the results back from the search.

My gut feeling is that it is an Alfresco configuration I have to make but I can't find any help from Google that makes sense.

Can anybody tell me how to configure Alfresco to tell SOLR to "AND" together multiple fields rather than "OR" them?

Thanks
Ewan
4 REPLIES 4

mrogers
Star Contributor
Star Contributor

ewan_ritchie
Champ in-the-making
Champ in-the-making
Thanks for the reply.

I read the section about Search Improvements in Alfresco 5.0 and it says "The default search operator for a multi-term search has changed from OR to AND".  The term "default" says to me that it is configurable.  Can you please confirm this?  If it is configurable in 5.0 is it configurable in 4.2e?

What I am looking for how to change the default search operator for a multi-term search in Alfresco 4.2e using SOLR .  Could you help my by pointing to the configuration option or provide me details on how to achieve this?

If this is not possible in Alfresco 4.2e using SOLR is it an option for us to revert back to using Lucene indexing?  I ask this because I had previously tried to enable Lucene indexing on 4.2e and could not get the system to index at all and it also suffered from really long start times for the webapps running under Tomcat (the system could take 1.5 hours to start which we couldn't find a solution for).

Thanks for your assistance.

Regards
Ewan

I am grateful to know that that feature is now available in Alfresco 5 but since I have just upgraded to 4.2e (decision made by management prior to Alfresco 5 being released) I am looking for a solution for 4.2e.

I have verified there is an issue by writing some CMIS queries and I get the results I am expecting.  A generalized version of the queries I used are below and show where I believe the issue lies:

When searching for documents of a custom type in the Advanced Search screen and entering the following filters the search returns 11 results (which I am told is correct):

<strong>Title (free text): </strong>OVERHEAD

<strong>Site Name (list): </strong>REFINERY

<strong>Area Code (list): </strong>XX45

<strong>Discipline (list): </strong>ELECTRICAL


When we add in the following filter the search results and it returned more than 1000 documents rather than the 5 documents expected:

<strong>Drawing Code (list): </strong>EL32 TECHNICAL DOCUMENTS

To verify what to expect from each search we used the following queries:
<CODE>SELECT ed.*,dc.*,t.* FROM cust:engDoc AS ed JOIN cust:documentControl AS dc ON ed.cmisSmiley SurprisedbjectId = dc.cmisSmiley SurprisedbjectId JOIN cm:titled AS t ON ed.cmisSmiley SurprisedbjectId = t.cmisSmiley SurprisedbjectId WHERE t.cm:title LIKE '%OVERHEAD%' AND ed.custSmiley FrustratediteName = 'REFINERY' AND ed.cust:AreaCode = 'XX45' AND dc.custSmiley Very Happyiscipline = 'ELECTRICAL'</CODE>
Returned 11 results as expected.

<CODE>SELECT ed.*,dc.*,t.* FROM cust:engDoc AS ed JOIN cust:documentControl AS dc ON ed.cmisSmiley SurprisedbjectId = dc.cmisSmiley SurprisedbjectId JOIN cm:titled AS t ON ed.cmisSmiley SurprisedbjectId = t.cmisSmiley SurprisedbjectId WHERE t.cm:title LIKE '%OVERHEAD%' AND ed.custSmiley FrustratediteName = 'REFINERY' AND ed.cust:AreaCode = 'XX45' AND dc.custSmiley Very Happyiscipline = 'ELECTRICAL' AND ed.custSmiley Very HappyrawingCode = 'EL32 TECHNICAL DOCUMENTS'</CODE>
Returned 5 results as expected.

We have checked and there is mention that in Alfresco 4.2 SOLR uses the OR operator on fields that contain multiple values (i.e. there are spaces in the search term…like "EL32 TECHNICAL DOCUMENTS").  This would mean that the equivalent CMIS search would be something like:
<CODE>SELECT ed.*,dc.*,t.* FROM cust:engDoc AS ed JOIN cust:documentControl AS dc ON ed.cmisSmiley SurprisedbjectId = dc.cmisSmiley SurprisedbjectId JOIN cm:titled AS t ON ed.cmisSmiley SurprisedbjectId = t.cmisSmiley SurprisedbjectId WHERE t.cm:title LIKE '%OVERHEAD%' AND ed.custSmiley FrustratediteName = 'REFINERY' AND ed.cust:AreaCode = 'XX45' AND dc.custSmiley Very Happyiscipline = 'ELECTRICAL' AND ed.custSmiley Very HappyrawingCode LIKE '%EL32%' OR ed.custSmiley Very HappyrawingCode LIKE '%TECHNICAL%' OR ed.custSmiley Very HappyrawingCode LIKE '%DOCUMENTS%'</CODE>
Returned 18064 results

If I change the OR operators to AND operators the query becomes:
<CODE>SELECT ed.*,dc.*,t.* FROM cust:engDoc AS ed JOIN cust:documentControl AS dc ON ed.cmisSmiley SurprisedbjectId = dc.cmisSmiley SurprisedbjectId JOIN cm:titled AS t ON ed.cmisSmiley SurprisedbjectId = t.cmisSmiley SurprisedbjectId WHERE t.cm:title LIKE '%OVERHEAD%' AND ed.custSmiley FrustratediteName = 'REFINERY' AND ed.cust:AreaCode = 'XX45' AND dc.custSmiley Very Happyiscipline = 'ELECTRICAL' AND ed.custSmiley Very HappyrawingCode LIKE '%EL32%' AND ed.custSmiley Very HappyrawingCode LIKE '%TECHNICAL%' AND ed.custSmiley Very HappyrawingCode LIKE '%DOCUMENTS%'</CODE>
Returned 5 results

The only solution I can think of at the moment is to update all the lists that have spaces in individual items and replace the spaces with another character (for example an underscore) and then update the meta-data for all content to reflect this (which feels like using a sledgehammer to crack a nut as we have nearly 1 million documents in Alfresco and the update will take a lot of effort and time).

Any help with this issue would be appreciated.

Thanks
Ewan

I found a really nice plugin called <strong>AlfrescoShareANDSearch</strong> that seems to mitigate the issues I have seen.

Hopefully it will help other people who have the same issue.

Regards
Ewan