eZ Find fetch in one specific site id when installation is in multiple site environment

Author Message

Matthieu Sévère

Friday 02 April 2010 1:36:21 am

Hello,

I'll try to explain better than my post title :)

I have about 5 eZ Publish on the same server all have eZ Find and I have one solR instance for them.

So each site have an index. Let's name website A, B, C, ...

I would like to query the index of website B from website A.

I know that I can enable 'SearchOtherInstallations' in ezfind.ini but It will query all index.

What solution do you advise me ?

I have seen the fetch function "rawSolrRequest". It seems I can directly give a solR request so I would be able to give a specific site ID but I don't know if it's a good solution ..

Thanks for you help :)

--
eZ certified developer: http://ez.no/certification/verify/346216

Nicolas Pastorino

Friday 02 April 2010 8:38:35 am

Hi Matthieu,

When enabling 'SearchOtherInstallations', eZ Find will search the public indexed content of any other eZ Publish instance using the same Solr engine. This is not very granular though, as you say. The option of adding a raw request appendix is definitely one technical way of doing, waiting for eZ Find to allow for more configurability on this point. From the top of my head, your ezfind.ini override could look like this :

[SiteSettings]
SearchOtherInstallations=enabled

[SearchFilters]
RawFilterList[]='meta_installation_id_s:6277a18357e711cf13fd15dbef90ce0d'

where the last element of the raw filter is the ezfind_site_id, which you can get this way :

SELECT value FROM ezsite_data WHERE name='ezfind_site_id';

or using PHP :

$eZFindSiteId = eZSolr::installationID();

You can obviously 'OR' the different site as follows :

[SearchFilters]
RawFilterList[]='meta_installation_id_s:6277a18357e711cf13fd15dbef90ce0d OR meta_installation_id_s:1234a18357e711ccde5d15dbef90ce0d'

I was sure there was an issue reported for easing the control of which third-party eZ Publishi instance are searched in, but can't get a hold on it now. I may have dreamt a bit. You may want to report it !

Hope it helps,
Cheers !

Hope it helps!

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Matthieu Sévère

Friday 02 April 2010 8:45:42 am

Ok, so that's the way to do.

I didn't know about the RawFilterList. I'll try that next week and post my feedback here (and an issue on ezfind tracker).

Thanks for you help Nicolas :)

--
eZ certified developer: http://ez.no/certification/verify/346216

Paul Borgermans

Friday 02 April 2010 9:11:46 am

After enabling

SearchOtherInstallations=enabled

You can also try to do it dynamically possibly searching across more than one, by passing the id's you want to search for in the'filter' parameter for the ezfind fetch function in templates:

 'meta_installation_id_s:(siteIDA OR siteIDB)'

You have to look up the side id's as Nicolas described above

Be aware if you use the RawFilterList, it will always be applied for that siteaccess (or globally if you specify it in the extension settings).

For the good understanding: all this only works if you have several sites using a common ezpublish DB

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Matthieu Sévère

Friday 02 April 2010 10:56:32 am

Thank you Paul for your advices but I'am very surprised reading your last sentence !!! I really thought that it was possible to request any index that "live" on the same solR instance. I don't really see why the need to have the same DB because if I understood well making a search with eZ Find is a REST request to solR server, am I wrong ?

So there is no mean to do that ?

Thank you for you help

--
eZ certified developer: http://ez.no/certification/verify/346216

Paul Borgermans

Friday 02 April 2010 1:13:16 pm

"

Thank you Paul for your advices but I'am very surprised reading your last sentence !!! I really thought that it was possible to request any index that "live" on the same solR instance. I don't really see why the need to have the same DB because if I understood well making a search with eZ Find is a REST request to solR server, am I wrong ?

So there is no mean to do that ?

Thank you for you help

"

Hi Matthieu,

You are right about the REST part ... but:

1) the permissions implementation still needs DB calls to be made, so ez Find can construct a corresponding Solr filter query. If its not in the same DB (with sites basically having all a different root node), it will fail .. well even worse, it does not make sense in the general case.

2) the returned objects to the templates are actualy extended versions of eZ Publish objects, requring DB calls for every result displayed

Now, the use-case you mention is actually part of a larger family of use cases and its being addressed in the next development cycle.

To solve 1), we'll have to implement a system to interrogate "foreign" eZ Publish instances about what permissions to activate (a set of policies basically) in order to construct the right query filter. The very simple implementation we currently have is that "foreign data" is searched as long as it is flagged to be readable by anonymous users .... ok for some use-cases, but certainly not in general

To solve 2), I am working on extending eZ Find so it also optionally stores serialized versions of eZ Publish objects. Once that is done, no more DB calls are needed for that part (and a large speedup possible too, but that is another story)

So if I understand your situation correctly, with indexes to be searched from really foreign installations, you will have to resort to the rawSolrRequest fetch function. You will be able to use the stored values for urls and so, as well as the "plain text" versions of most of what is indexed from attributes, but not the rich content (like ezxml, ezselection, ezmatrix, images, ... and so on) in the display of the search results

I hope this clarifies the limitations we have today (but which will certainly be lifted in future versions)

Have a nice weekend

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Matthieu Sévère

Tuesday 06 April 2010 12:45:26 am

Thank you for all this explanations it helped me a lot to understand all the mechanism of eZ Find.

I am looking forward to the next development cycle though ! The "to solve 2)" paragraph looks VERY interesting !

Cheers

--
eZ certified developer: http://ez.no/certification/verify/346216

Matthieu Sévère

Tuesday 06 April 2010 5:03:42 am

A little feedback about eZ Find rawSolrRequest fetch.

It works like a charm :) I have been able to request a foreign index very easily and luckily all the inforrmation I need is indexed.

Here is an example of a fetch for those we want to try :

{def $results = fetch(ezfind, rawSolrRequest, hash(
                                                    'baseURL', 'http://localhost:8983/solr',
                                                    'request','/select',                                                    
                                                    'parameters',hash('q','*:*',         
                                                                      'bq','meta_installation_id_s:54b480cf2df845e2606e2fe786d1eca9^1.5',
                                                    )))}

--
eZ certified developer: http://ez.no/certification/verify/346216

Nicolas Pastorino

Tuesday 06 April 2010 7:45:51 am

That is great news Matthieu, thanks for sharing !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.