Search

I need to implement search on a Symphony site shortly and have never done this before. I'll need the search to search within a content section (3 fields) and a products section (2 or 3 fields).

Would you guy recommend I use Elastic Search or Search index for this purpose?

Definitely ElasticSearch. The reason behind this is simple: you'll be able to grow your search engine if you need to, and make it as complex as you want. Things like faceted search are really awesome, and are quite easy to implement in ElasticSearch.

Setup can be demanding and frustrating, but once you have it running you'll be in love.

Great. Thanks for the feedback. It sounds like I might be doing a bit of banging my head against the wall until I hit the eureka moment.

Well I seem to have hit a wall already.I am trying to setup the index for 2 sections:

Products

  • Name (text input)
  • Description (text area)

Pages

  • Title (text input)
  • Heading (text input)
  • Content (text area)

I have created the json files and php files (pastie links follow):
pages.json, products.json, products.php, pages.php

I am using https://qbox.io and Symphony is successfully connecting to ES and creating an index when I save my Symphony preferences.

In my Symphony ES > Mappings I am able to rebuild mappings and I can see on the Qbox server that these are being sent.

Problem 1

When I try to reindex entries for either of my sections, I get a spinning wheel and an "Indexing page 1" message which doesn't seem to do anything. If I refresh the page, I see that zero entries are indexed.

Problem 2

When I go to session or query logs in Symphony, I get this error:

Fatal error: Call to undefined method General::generatePassword() in /srv/www/horizon.eyes-down.net/public_html/extensions/elasticsearch/content/content.queries.php on line 260

I don't know if these problems are related. Can anyone offer any suggestions? Thanks

Hah, I've been chatting with one of the developers of qbox yesterday to fix a few problems I was having. One of them was this 'infinite spinner' thing.

It turns out that Symphony is using routes that they do not yet support, which causes Symphony to blow up (even though they are not required at all).

I would love to send a bugfix for this, but unfortunately I am quite short on time the next few days. Do you have a very pressing deadline?

Aaa-ha (as opposed to eureka)! Well I'm glad to know that I'm not alone. I don't have a pressing deadline for this. I'm hoping the client can test it late next week, but even that is not set in stone.

I'd love the information when you ave the time to share it. Many thanks.

@stuart, you might want to see if their response times are up to par for you. They only have US based endpoints for now (they are looking into adding EU nodes, but I don't know how long that will take).

From Amsterdam the response times were over a second, so before you wait for bugfixes that are specific to them, please check if you can live with the latency.

Just received this from qbox:

Just letting you know that we're planning on having our cluster available in the London (or Slough) data center in the coming week or so.

Thanks for the info Huib. I'm considering installing it on my own server. I guess it depends how the Qbox situation unfolds.

@stuart, we (at qbox) just released a cluster hosted in Dublin, Ireland.

As far as the errors mentioned above -- we've been doing quite a bit of bug fixing as of late, so I'm curious to know if those are still an issue for you.

Thanks Ben. I tried to set this up again but now I get an error when I rebuild the mapping:

Symphony Fatal Error: RemoteTransportException[[Hydron][inet[/10.0.0.5:9300]][indices/mapping/delete]]; nested: TypeMissingException[[horizon-telecom] type[pages] missing];

I don't know if this is Symphony side or qbox side?

Stuart, is there any chance you could show me a sample of the code you're using to rebuild the mapping?

Hmmm, you got me. See I am using a pre-written extension which I can;t claim to understand, so isolating that code would be tricky for me. I think this might be what you are looking for?

https://github.com/nickdunn/elasticsearch/blob/master/content/content.mappings.php

That should be fine. I can generally debug from this point.

Is the error you pasted above occurring when you try to delete the mapping?

Yes I get the error when I try to delete or rebuild the mapping. I guess the latter deletes the mapping first?

Stuart, it looks like you're correct. Considering that and the "TypeMissingException" that you received, I'm assuming it's because the type you're trying to rebuild does not yet exist. You might try creating the mapping and then rebuilding to verify that it works.

Have you tested if the rebuild function runs on a clean local instance of ElasticSearch? If it's something that works normally, we definitely want to try to find what's causing it on our end.

@stuart, that's an issue with the extension, and it's one of the things I've fixed locally but not yet pushed :)

The fix is actually rather easy. On line 23 though 27 in content/content.mappings.php, replace:

foreach ($checked as $handle) {
    ElasticSearch::getIndex()->getType($handle)->delete();
    ElasticSearch::createType($handle);
    redirect("{$this->uri}/mappings/");
}

with

foreach ($checked as $handle) {
    try{
        ElasticSearch::getIndex()->getType($handle)->delete();
    }
    catch (Exception $e) {
    }
    ElasticSearch::createType($handle);
    redirect("{$this->uri}/mappings/");
}

This will make sure Symphony does not break when the index that is to be created is first deleted and then recreated.

Thanks Huib. That fixed the rebuild mapping function. I can now rebuild the mapping and reindex entries (which I couldn't before, so thanks Ben for the Qbox fix). The reindex entries function cycles through pages as it should.

Once I have reindexed entries however, I still see "0 entries" even though the section has 2 pages of entries. I presume that this should show a number of indexed entries. CAn anyone guess why?

On top of this, when I go to the logs I still get errors:

For the query log...

Fatal error: Call to undefined method General::generatePassword() in /srv/www/horizon.eyes-down.net/public_html/extensions/elasticsearch/content/content.queries.php on line 260

For the session log...

Fatal error: Call to undefined method General::generatePassword() in /srv/www/horizon.eyes-down.net/public_html/extensions/elasticsearch/content/content.sessions.php on line 261

Once I have reindexed entries however, I still see "0 entries" even though the section has 2 pages of entries. I presume that this should show a number of indexed entries. CAn anyone guess why?

Hmm, I think I've had the exact same problem before. Can you try going to DOMAIN/symphony/extension/elasticsearch/reindex/artikelen/1/ to see if there are any errors?

Oh, and about the logs: that's because the extension isn't fully compatible with the newest Symphony version yet...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details