We launched a website last week based on Craft CMS. One page contains mainly a list with links to sponsors (entered in a rich text field).

I make a fulltext search (via $critera->search) through the whole website, that works very fine, but it just didn't find the link texts inside a rich text field. (e.g. "Ascot", http://www.unidram.de/en/festival/partner-sponsors)

If I put the same text outside of the link, the search will find it. But that's not the solution, because the text should be the link.

I made a workaround and added Tags for every link to the page (except above given example). That did the job, but is additional work we won't normally do.

At first I clicked on "rebuild the search index".

The search on the website didn't find the page. This is the template part of the search:

{% set query = craft.request.getPost('q') %}
{% set entries =  
 craft.entries.search(query).section('seitenstruktur').order('score') %}

Then I searched for 'Ascot' in craft_searchindex in the DB.

Part of the content of the related field is this:

performance netzuniversitaetsgesellschaft potsdam sponsorenhochdreiascot bristolmedienpartnerpotsdamer neueste nachrichten

While the content looks like this:


So in fact the word 'Ascot' is saved as part of 'sponsorenhochdreiascot'. As soon as I change it to 'sponsorenhochdrei ascot', the entry will be found by the search on the website.

The HTML Code of the part is:

<p><a target="_blank" href="http://www.domainx.com/">HochDrei</a><br>
<a target="_blank" href="http://www.domainy.de/">Ascot 

The search index seems to miss some space characters.

  • Can you share the code you're using to search with? RTE fields get their data saved to craft_searchindex just like any other textual field. You can find the field ID for the field you're searching against and find the corresponding row in craft_searchindex to verify ascot is in the search data. – Brad Bell Sep 25 '15 at 22:17
  • I made further tests. please sea the edited question, because comments just allow mini markdown formatting. – phaetons Sep 27 '15 at 13:46

The reason that searching for Ascot doesn't match sponsorenhochdreiascot is because Craft doesn't do wildcard or fuzzy searching by default.

If you search for *ascot it would match. You can all of the supported search syntaxes here: http://buildwithcraft.com/docs/searching

Update: As of Craft 2.5, you can enable fuzzy searching by default.

| improve this answer | |
  • oahahh, damn. Sometimes one didnt see the simplest things. Thanks Brad! – phaetons Sep 28 '15 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.