Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 707393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:16:22+00:00 2026-05-14T04:16:22+00:00

I have an object Title : foo Summary : foo bar Body : this

  • 0

I have an object

Title   : foo
Summary : foo bar
Body    : this is a published story about a foo and a bar

All three are set up as fields with stored=true.

The user searches across my system for the word

"foo"

I would like to highlight foo in all three places.

The user searches for the word foo in the title

"title:foo"

I only want to highlight foo within the title.

When I added
hl.requireFieldMatch=true and hl.usePhraseHighlighter=true as part of my query over to SOLR I am unable to get the highlighting in all three places when doing a generic non fielded search. Is there a way to get both scenarios to work?

I had these two items turned off, but I am adding in some fielded portions of the query that the user does not see which only display Published items for instance. the problem is

(foo AND status:published)

is causing the word published in the body to highlight when the user only searched for the word “foo”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:16:22+00:00Added an answer on May 14, 2026 at 4:16 am

    Turns out that this may be more of a quirk with act_as_solr than it is with solr / lucene.

    I took advantage of the fq option within solr
    http://wiki.apache.org/solr/CommonQueryParameters#fq

    the query no longer looks like

    (foo AND status:published)
    

    Looks more like

    q=foo&fq=status:published
    

    when it hits solr

    The fq does not impact highlighting and it seems like a better way to do this since you get some solr caching benefits.

    There is still a bug / feature not implemented with acts_as_solr which needs to take advantage of this as well.

    For instance if my model is named article, and the user searches for the word article, AAS is building a query behind the scenes that looks like

    (article AND type_t:article)
    

    This causes the same problem that the word article highlights all over the place when you don’t want it to, as well as when the user searches for the term “article” they get back every single object in the system.

    Took a quick look at GitHub forks of acts_as_solr and didn’t see anyone that has implemented this yet. There is nice #TODO sitting there within parser_methods.rb

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 371k
  • Answers 371k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your e-mails are already in a database. One possible approach… May 14, 2026 at 7:09 pm
  • Editorial Team
    Editorial Team added an answer var query = from list in lists from value in… May 14, 2026 at 7:09 pm
  • Editorial Team
    Editorial Team added an answer m_const_member(new some_const_struct((const some_const_struct){a, b})) Such syntax is not allowed by… May 14, 2026 at 7:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.