Skip to main content

Articles tagged with "search"

Language lessons: How can I fix my autocomplete box?

10th Nov 2015

Languages make everything so complicated! I just discovered the autocomplete bit on my reference fields wasn't working - until I tried searching by another language, and then the results gave me a surprise:

Autocomplete results are not in the same language as their search input for entity reference fields

 

My homepage, originally in French, has had an English translation added, but whilst editing in English, I had to search with the French title in order for the page to come up... with the English title! Here's how to solve this...

My site uses Entity translation and the Title module (which I usually recommend as the best way of making your site translatable), and this...

Read more

Apache Solr boost Drupal search results at query-time

11th Mar 2011

Boosting terms in Solr search results produced by the Apache Solr Search module that integrates Solr with Drupal is something we had to do for a project recently. If a user has come to our website from a search engine, we can pick up the terms that they had originally searched for - and then boost any documents containing those terms in our own search pages, regardless of what they search for on our pages. (So for example, a user searches Google for 'Ski Holidays', comes to our site, and anything ski-related items should be more prominent than they would...

Read more

Quick tips: Inspecting a Solr Document

22nd Feb 2011

Another quick tip here: if you're working with the Apache Solr module, specifically looking at the documents that are being created from your nodes, and you want to print out the document and have a look at what fields and values are on your $document then if you did this:


// Print the $document using the devel dpm function.
dpm($document);

Then you would get a very unhelpful output from Krumo, because all the fields on the $document are protected, and so the devel module can't access them. Instead you can do this:


dpm(array_combine($document->getFieldNames(), $document->getFieldValues()));

And you'll get a nice array...

Read more