Hi,

I have a website. I want to put a searchbox and search what i want to find in content of my website not in database file. How can i do this?

Thanks

Dani AI

Generated

Since decided to go the database route, here is a compact, practical roadmap that complements ’s point about indexing being preferable to parsing pages on the fly.

Start by deciding the search backend and trade-offs:

  • SQL Server Full‑Text Search — low friction if the site already uses SQL Server; good for moderate traffic and simple ranking.
  • Lucene.NET — an embeddable .NET library with strong control over analyzers, scoring and tokenization.
  • Hosted/search-as-a-service (Elasticsearch, cloud search providers) — best for scalability, faceting, suggestions and advanced relevance features, at the cost of extra operational complexity.

Index design and content preparation:

  • Store one document record per page with fields: id, URL, title, cleaned body text, publish date, language, tags/categories and permission flags.
  • Strip boilerplate (menus, headers, footers) and decode HTML before indexing; use an HTML parser rather than brittle regex to avoid junk in results.
  • Decide on analyzers: case folding, stop word lists, stemming or synonyms depending on the site language and query types.

Operational details and UI:

  • Keep the index fresh with an incremental updater (background job or queue) rather than rebuilding on every change.
  • Present results with snippets and highlighted matches, pagination, phrase and boolean support, and simple filters (date, category).
  • Enforce permissions at query time so private content never appears in public searches.

Tuning and maintenance:

  • Measure relevance with real queries, tune stopwords/synonyms, and rebuild/analyze periodically.
  • Monitor query latency, index size and update lag so search stays fast and accurate.

These steps give a durable, scalable search foundation for an ASP.NET site using a database-backed index.

Recommended Answers

All 2 Replies

With any kind wof search it's always better to have some kind of index, database or otherwise as parsing pages for content on the fly is very slow. Is all your content flat? as in on the pages? I suppose one databaseless way of doing this would be to put your content (provided it's not a huge amount) in an xml file, load it into a datatable and use DataTable.Select its still not great but perhaps a possible stop gap till you have a truly dynamic site. The benefit of the xml file is that it can be asily updated, but performance wise it isnt a great idea. Alternatively google offer a search box, but to get any decent results you will have to a) sign up and b) wait till your pages get spidered esle the results will be all google sponsered ads.

Hi,
I think i ll do it with using database. That is better.
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.