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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:55:17+00:00 2026-06-18T09:55:17+00:00

We are using dtSearch to index some external web pages. It grabs the entire

  • 0

We are using dtSearch to index some external web pages. It grabs the entire HTML content of the page.

When a page shows up in a list of search results on our web site, we want to show an excerpt of the content that contains their highlighted/bold search term as part of the result (in other words, the same thing everyone is used to seeing under each Google result).

What it the best way to accomplish this? Do you have to parse and remove the HTML tags? If so, how do you do that effectively?

We have a proof of concept working, showing the excerpt with the search terms highlighted, but we have to either render the tags, or try to strip them out (as we have tried) and end up with some garbage information that’s not really content.

The fact that we are using dtSearch is incidental, I think. If an alternative search tool is capable of doing this type of thing in our behalf, we’d consider using that instead.

We are basically trying to decide if we need to author our own regular expressions to accomplish this or if it’s a well-known problem that’s already solved by some library or tool.

We happen to be using .NET/C#. I don’t think it’s central to the problem but might impact what libraries we can use.

  • 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-18T09:55:18+00:00Added an answer on June 18, 2026 at 9:55 am

    Google uses meta description tags where present, and will also use rich snippet information where available.

    Beyond that, you may need to perform custom parsing, but don’t use regular expressions to perform the whole task. Rather, use a proper parser (such as HTML Aglity Pack) and find tags which make semantic sense (perhaps headings, paragraphs, etc.) Once you have located such elements, you might use a regex to determine which of the matched tags would give you the best snippet, where to truncate it, etc.

    A simple flow:

    1. parse the document and locate all elements with a significant amount
      of textual content.
    2. strip inner tags (e.g. strong inside of a p)
    3. prefer elements near the beginning of the document.
    4. run an algorithm (possibly using regex(es), and possibly culture-aware) to try to extract sentences.
    5. strongly prefer sentences with words matching one or more search terms (based on your stated requirements).
    6. prefer sentences with few noise words.
    7. (advanced) prefer sentences which have words occurring regularly in the document.
    8. (advanced) combine multiple, potentially useful sentences into a single description snippet.

    It’s not an exact science, even for Google.

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

Sidebar

Related Questions

I'm using dtSearch to highlight text search matches within a document. The code to
I want some search feature in my website. In the output page, I am
How can i make Sitecore able to search 2 indexes using dtSearch? In the
Here's a jsFiddle that shows what I'm trying to do: http://jsfiddle.net/P3c7c I'm using the
We are using the ASP.NET 1.1 version of dtSearch and are having an issue
I have this 'web service' I made that when accessed: http://192.168.0.1/api/v1/search/?query=thequery returns a JSON
I'm using and ExecutorService to concurrently run some Callables . Here's a simplified version
I am mapping some concert locations on google maps, using data from Songkick.com's API.
I am having some dramas with accessing LDAP using C# with my ASP project.
Using Android NDK is it possible (from native C-code) to get a list of

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.