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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:00:19+00:00 2026-05-19T01:00:19+00:00

I am building a full text search facility for my website coded in asp.net

  • 0

I am building a full text search facility for my website coded in asp.net mvc with mysql database. This website is for a non-english language. I have started work on it using Lucense as the engine for searching the text, but I can’t find any info on whether it supports unicode?

Does anyone have any information on whether Lucene supports Unicode? I don’t want a nasty surprise..

Also links to beginner articles on implementing lucene.net will be appreciated.

  • 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-19T01:00:20+00:00Added an answer on May 19, 2026 at 1:00 am

    Yes. It fully support unicode.
    But for analyzing you should explicitly assign appropriate stemmers and correct stopwords.
    As for sample. Here is copy from our last project

    directory = new RAMDirectory();
                analyzer = new StandardAnalyzer(version, new Hashtable());
                var indexWriter = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
                using (var session = sessionFactory.OpenStatelessSession())
                {
                    organizations = session.CreateCriteria(typeof(Organization)).List<Organization>();
                    foreach (var organization in organizations)
                    {
                        var document = new Document();
                        document.Add(new Field("Id", organization.ID.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                        document.Add(new Field("FullName", organization.FullName, Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));
                        document.Add(new Field("ObjectTypeInvariantName", typeof(Organization).FullName, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                        indexWriter.AddDocument(document);
                    }
    
                    var persistentType = typeof(Order);
                    var classMetadata = DbContext.SessionFactory.GetClassMetadata(persistentType);
    
    
                    var properties = new List<PropertyInfo>();
                    for (int i = 0; i < classMetadata.PropertyTypes.Length; i++)
                    {
                        var propertyType = classMetadata.PropertyTypes[i];
                        if (propertyType.IsCollectionType || propertyType.IsEntityType) continue;
                        properties.Add(typeof(Order).GetProperty(classMetadata.PropertyNames[i]));
                    }
    
                    orders = session.CreateCriteria(typeof(Order)).List<Order>();
                    var idProperty = typeof(Order).GetProperty(classMetadata.IdentifierPropertyName);
    
                    foreach (var order in orders)
                    {
                        var document = new Document();
                        document.Add(new Field("Id", idProperty.GetValue(order, null).ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                        document.Add(new Field("ObjectTypeInvariantName", typeof(Order).FullName, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                        foreach (var property in properties)
                        {
                            var value = property.GetValue(order, null);
                            if (value != null)
                            {
    
                                document.Add(new Field(property.Name, value.ToString(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));
                            }
                        }
                        indexWriter.AddDocument(document);
                    }
                    indexWriter.Optimize(true);
                    indexWriter.Commit();
                    return indexWriter.GetReader();
                }
    

    I’m querying Organization objects from NHibernate and put them into Lucene.NET

    Here is simple search

    var searchValue = textEdit1.Text;
    
                    var parser = new QueryParser(version, "FullName", analyzer);
                    parser.SetLocale(new CultureInfo("ru-RU"));
                    Query query = parser.Parse(searchValue);
                    var indexSearcher = new IndexSearcher(directory, true);
    
                    var docs = indexSearcher.Search(query, 10);
                    lblSearchTotal.Text = string.Format(totalPattern, docs.totalHits, organizations.Count() + orders.Count);
                    resultPanel.Controls.Clear();
                    foreach (var found in docs.scoreDocs)
                    {
                        var document = indexSearcher.Doc(found.doc);
                        var objectId = document.Get("Id");
                        var objectType = document.Get("ObjectTypeInvariantName");
    
                        if (resultPanel.Controls.Count > 0)
                        {
                            var labelSeparator = CreateSeparatorLabelControl();
                            resultPanel.Controls.Add(labelSeparator);
                        }
                        var labelCard = CreateFoundLabelControl();
                        resultPanel.Controls.Add(labelCard);
    
                        var organization = organizations.Where(o => o.ID.ToString() == objectId).FirstOrDefault();
                        if (organization != null)
                        {
                            labelCard.Text = string.Format("<b>{0}</b></br>{1}", organization.AccountNumber, organization.FullName);
                            labelCard.Tag = organization;
                            //labels[count].Text = string.Format("<b>{0}</b></br>{1}", organization.AccountNumber, organization.FullName);
                            //labels[count].Visible = true;
                        }
                        else
                        {
                            labelCard.Text = string.Format("Найден объект типа '{0}' с идентификатором '{1}'", objectType, objectId);
                            labelCard.Tag = mainForm.GetObject(objectType, objectId); 
                        }
                        labelCard.Visible = true;
                        //count++;
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an ASP.NET MVC site where I want to use Lucene.Net for full-text
I'm building an asp.net page that uses a page method call from jquery. This
I have an existing website developped using ASP.NET MVC 3 and Entity Framework 4
I've looked into SQL 2008's built-in Full-Text search, and also Lucene.NET.. but I don't
Building a website that has English & Japanese speaking users, with the Japanese users
I'm building a website for learning pruposes and i'm looking at lucene.net as a
I'm building a WebService (CXF with Spring and JPA) to search a read-only database
I'm looking at implementing tags in my ASP.NET website. After looking at several algorithms,
I'm about to embark on the ASP.net project which involves building a pretty powerful
I am building a ASP.NET page which is an Sales Order Processing Form I

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.