0

I have a Drupal 7 site using the Search API and Search API Apache SOLR modules to provide search functionality to site visitors.

I'm running Apache SOLR 4.10.2 within my development Vagrant VM environment, and search results are returned for both stemmed and unstemmed terms which is great:


Example search term: "car"

Apache SOLR returns nodes with fields containing the text "car" and "cars"


The problem is, when Apache Solr returns nodes containing the stemmed term "cars", no highlighted excerpts are returned. However results containing the exact term "car" are returned with a hightlighted excerpt as expected.

After extensive searching I found this blog post which contains instructions on how to enable stemming for highlighted excerpts, but no luck.

Here is the excerpt of my schema.xml config file as per the instructions in the blog post:

<!--  Setup simple analysis for spell checking -->

 <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100">
   <analyzer>
     <tokenizer class="solr.StandardTokenizerFactory" />
     <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
     <filter class="solr.LengthFilterFactory" min="4" max="20" />
     <filter class="solr.LowerCaseFilterFactory" />
     <filter class="solr.RemoveDuplicatesTokenFilterFactory" />
     <filter class="solr.PorterStemFilterFactory"/>
   </analyzer>
 </fieldType>

I have restarted my VM and cleared and reindexed all the nodes, but still no dice.

Has anyone else had this issue before?

Thanks in advance!

1

I'm guessing that you, like me, had the "Highlight" filter enabled, which you shouldn't actually do for Solr. I found this nugget of info here:

https://www.drupal.org/node/2358065#comment-9319765

Though Solr returns the excerpt, that processor removes it if there's not an exact match.

  • awesome, thanks! will give this a go and post results – Alex Kirsten Aug 15 '16 at 11:41

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.