eZ Community » Forums » Extensions » eZ Find » eZ Find fetch in one specific site id...
expandshrink

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

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

Friday 02 April 2010 10:36:21 am - 8 replies

Hello,

I'll try to explain better than my post title happy.gif Emoticon

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 happy.gif Emoticon

Friday 02 April 2010 5:38:35 pm

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!

Friday 02 April 2010 5:45:42 pm

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 happy.gif Emoticon

Friday 02 April 2010 6:11:46 pm

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

Modified on Friday 02 April 2010 6:12:28 pm by Paul Borgermans

Friday 02 April 2010 7:56:32 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

Friday 02 April 2010 10: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

Modified on Friday 02 April 2010 10:19:15 pm by Paul Borgermans

Tuesday 06 April 2010 9: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

Tuesday 06 April 2010 2:03:42 pm

A little feedback about eZ Find rawSolrRequest fetch.

It works like a charm happy.gif Emoticon 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',
                                                    )))}

Tuesday 06 April 2010 4:45:51 pm

That is great news Matthieu, thanks for sharing !

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from