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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:20:03+00:00 2026-05-25T22:20:03+00:00

I have not been able to get this nailed down. I have tried several

  • 0

I have not been able to get this nailed down. I have tried several different analyzers and they all get me close, but not exactly what I want. Using SOLR is not an option at the moment.

An examples of what I would like:

    Input: 200
    Matches:  200 E Dragon Dr.
              200 W Paragon Rd.
              200 Lick Skillet Dr.

    Input: 200 E
    Matches:  200 E Dragon Dr.
              200 E Toll Rd.

    Input: 200 E D
    Matches: 200 E Dragon Dr.

If I use the simple analyzer then it will not match on the number. The whitespace analyzer gets the desired effect with just the number, but once I add the E it does not return as I expect. What would be the best analyzer or am I using the wrong queries?

Thanks,

EDIT:

I have taken the below answer and did a ton of googling and I am getting close just using the query parser and the whitespaceanalyzer. I am just letting the query parser determine the best query and it seems to work.

  • 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-25T22:20:04+00:00Added an answer on May 25, 2026 at 10:20 pm

    try using a keyword analyzer and a query parser to search an address field in Lucene. I am using a MultiFieldQueryParser, but you could use a regular query parser too:

    public StartsWithQuery Prefix(string prefix, string[] fields, Dictionary<string,string> filterFields = null )
            {
               if(!string.IsNullOrEmpty(prefix))
               {
    
    
                   var parser = new MultiFieldQueryParser(Version.LUCENE_29, fields, new KeywordAnalyzer());
                   var boolQuery = new BooleanQuery();
    
                   boolQuery.Add(parser.Parse(prefix + "*"), BooleanClause.Occur.MUST);
                   if (filterFields != null)
                   {
                       foreach (var field in filterFields)
                       {
                            boolQuery.Add(new TermQuery(new Term(field.Key, field.Value)), BooleanClause.Occur.MUST);
    
                       }
                   }
    
               }
    
                return this;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried about 6 different methods and have not been able to get
I'm new to Linq and have not been able to get this working. public
I have not been able to find any definitive answers to this question: Can
So this is something that I have not been able to find any documentation
I have tried a lot but not been able to understand the steps involved
I have been using this as a reference, but not able to accomplish exactly
I have not been able to get drupal_get_form to pass on the node data.
In my implementation of Java NIO I have not been able to get SelectionKey.attach()
I have been trying to get this to work with several tutorials/answers here, but
I am very new to PhoneGap yet have not been able to get some

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.