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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:59:20+00:00 2026-05-13T06:59:20+00:00

My application uses Lucene.NET to index various text files. Since each text file is

  • 0

My application uses Lucene.NET to index various text files. Since each text file is different in structure, the entire content of each file is stored in a single “content” field.

Some of the text files contains URLs, e.g:

http://domain1.co.uk/blah
http://domain2.co.ru/blahblah

etc.

The code I use to index each file is:

Lucene.Net.Documents.Field fldContent = new Lucene.Net.Documents.Field("content", contents, Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.TOKENIZED, Lucene.Net.Documents.Field.TermVector.YES);

Where “contents” is the file contents.

When querying the file, Lucene returns result only when searching for the exact domain name (e.g domain1.co.uk) and nothing is returned for partial domain name (e.g domain1.co).
The code used to build the query is:

Lucene.Net.Index.Term searchTerm = new Lucene.Net.Index.Term("content", "domain1.co");
Lucene.Net.Search.Query query = new Lucene.Net.Search.TermQuery(searchTerm);

Do you have any idea why must I search using the exact domain name?

  • 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-13T06:59:21+00:00Added an answer on May 13, 2026 at 6:59 am

    The StandardAnalyzer/Tokenizer is the culprit here – it does it’s best to make URLs searchable, but in this case, it will not match a partial hostname. The standard approach is to create a custom analyzer/tokenizer – for this I can point you to another SO question with a similar problem and solution.

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

Sidebar

Related Questions

I am using a read-only Lucene.NET index in a web application and creating a
I've a .net web application which uses Lucene.net for company search functionality. When registered
We have an application that uses Lucene.NET within a windows service to reindex our
I'm working on an asp.net application which uses Lucene.net I need to highlight the
I've an asp.net web application which uses Lucene API for search. Here is the
I'm working on a .Net application which uses Asp.net 3.5 and Lucene.Net I am
My application uses a 3rd party dll. If I remove myapp.exe.local file from my
My application uses asp.net 4, C# and Entity Framework. My database contains a table
My application uses a large amount of Panda objects. Each Panda has a list
Our application uses a XML configuation file. I thought that it would be nice

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.