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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:08:37+00:00 2026-05-13T08:08:37+00:00

I am trying to use Lucene to search for names in a database. However,

  • 0

I am trying to use Lucene to search for names in a database. However, some of the names contain words like “NOT” and “OR” and even “-” minus symbols. I still want the different tokens inside the names to be broken up using an Analyzer and searched upon as a boolean combination of terms, but I do not want Lucene to interpret any of the “NOT”/”OR” terms as operators (instead I want them to be searched upon like normal terms).

One way to accomplish what I am talking about would be to manually run the Analyzer on the search query and then manually construct a boolean query based on all the resulting tokens. Is this the best way? I get the impression that analyzer’s were designed to be used in conjunction with the query parser and I feel like there should be a built-in way to accomplish what I am trying to do. Anyone know the best way to do this?

  • 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-13T08:08:37+00:00Added an answer on May 13, 2026 at 8:08 am

    Your own suggested approach of constructing a BooleanQuery from a TokenStream makes complete sense. The QueryParser API is really just intended for parsing structured queries using a specific syntax – if you are not leveraging the query parser syntax, I see no reason to use QueryParser over a manually constructed BooleanQuery.

    However, if you are using a StandardAnalyzer (or another analyzer with a StopFilter) to index your fields, words like “AND”, “NOT” and “OR” will not be indexed, and cannot be searched on. So in that case you could just as easily strip those words and operators like “-” and “+” from your queries using a regular expression. I would sooner recommend the BooleanQuery approach, however.

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

Sidebar

Related Questions

I am trying to index a table in a database using Lucene. I use
Trying to use Zend_Search_Lucene to search a MySql database and display the results. Running
I'm trying to use lucene 4.0 snapshot version, however StandardAnalyzer is missing in this
I'm trying to use Apache Lucene for tokenizing, and I am baffled at the
I am trying use gem tire to search in my application. I have tables
I am trying use javascript regular expressions to do some matching and I found
I have been trying use the edit_post_link() function to contain an image. All of
I am coding search engine using Zend Framework Lucene. I'm trying to make fuzzy
I am using Lucene 3.5.0 to do some basic search stuff on my website.
I want to use Lucene.NET for fulltext search shared between two apps: one is

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.