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 9220363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:19:44+00:00 2026-06-18T03:19:44+00:00

We are trying to execute a solr based search on the content of text

  • 0

We are trying to execute a solr based search on the content of text files and the requirement is trying to return all the hits of the search term in each document along with the highlighted text around the hit.

We are able to return the number of documents found along with the highlighted snippet around the first hit of the search term in the document. But is does not return the list of highlights across the document where the search term is found. We can get the TermFrequency reported as the correct number but not the snippets around all these occurrences.

Relevant portion of the solr schema:

<field name="Content" type="text_general" indexed="false" stored="true" required="true"/>
<field name="ContentSearch" type="text_general" indexed="true" stored="false" multiValued="true"/>

<copyField source="Content" dest="ContentSearch"/>

For example, if we have a.txt and b.pdf which are indexed, and the search term
“case” exists in both the documents multiple times(a.txt – 7 hits, b.pdf – 10
hits), when executing a search for “case” against both the documents, we are
getting two documents returned with the correct term frequencies(7 and 9) but the highlight list contains only one record which corresponds to the first hit in the files.

Is this something to do with using TermVectorComponent for the content field. I have read but could not quite make out the way the TVC works and in which situation it is helpful.

  • 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-06-18T03:19:46+00:00Added an answer on June 18, 2026 at 3:19 am

    This is due to the default settings for Highlighting. In order to achieve what you want, I would recommend changing the snippets and maxAnalyzedChars options. By default the snippets is set to only return one snippet and maxAnalyzedChars will only look at the first 51200 characters. I would set these values to snippets=20 (or some value larger than the expected max number of snippets) and maxAnalyzedChars=100000 (or some other value larger than the longest field value) this will ensure that the entire value is analyzed and that all highlights are returned.

    Note: You may also need to work with the fragsize setting to get the appropriate size for the snippets (to include the line before and after the highlighted word). As the default size for the fragments is 100 characters.

    Within SolrNet you would need to set the Snippets and MaxAnalyzedChars properties on the HighlightingParameters you are passing to your query. Like something similar to the following:

       var results = solr.Query(new SolrQueryByField("ContentSearch", "case"), 
         new QueryOptions {
           Highlight = new HighlightingParameters {
              Fields = new[] {"ContentSearch"},
              Snippets = 20,
              MaxAnalyzedChars = 100000,
          }
       });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Solr with Magento Enterprise. I'm trying to change the default search operator
Im trying to execute the following SQL query and filter out the data based
I am using Apache Solr 1.4 with dismax, and I am trying to execute
Trying to execute search on Facebook for pages if (sq.ObjectType.Equals(page)) { searchPath = /search;
I'm trying to query my solr database based off the code provided in this
I'm trying execute the DataTable example avaiable on Primefaces Showcase . All functions works
I'm trying to create a custom search interface for Apache Solr using Drupal ,
I am trying to use solr with DIH to index csv files. I've patched
I'm trying to execute an E4X query (on the xml below) that will return
I'm trying to execute a stored procedure on SQL Server from an MFC based

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.