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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:23:32+00:00 2026-05-11T02:23:32+00:00

I am using Lucene to allow a user to search for words in a

  • 0

I am using Lucene to allow a user to search for words in a large number of documents. Lucene seems to default to returning all documents containing any of the words entered.

Is it possible to change this behaviour? I know that ‘+’ can be use to force a term to be included but I would like to make that the default action.

Ideally I would like functionality similar to Google’s: ‘-‘ to exclude words and ‘abc xyz’ to group words.

Just to clarify I also thought of inserting ‘+’ into all spaces in the query. I just wanted to avoid detecting grouped terms (brackets, quotes etc) and potentially breaking the query. Is there another approach?

  • 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. 2026-05-11T02:23:33+00:00Added an answer on May 11, 2026 at 2:23 am

    This looks similar to the Lucene Sentence Search question. If you’re interested, this is how I answered that question:

    String defaultField = ...; Analyzer analyzer = ...; QueryParser queryParser = new QueryParser(defaultField, analyzer);  queryParser.setDefaultOperator(QueryParser.Operator.AND);  Query query = queryParser.parse('Searching is fun'); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using lucene as Search engine. When we use the standardAnalyser,the stop words
I'm using Lucene to get frequency of terms in documents, i.e. number of occurrences
I'm using Lucene to search through an index of XML documents. I'm supposed to
We're currently using Lucene 2.1.0 for our site search and we've hit a difficult
I'm looking into using Lucene and/or Solr to provide search in an RDBMS-powered web
I have some code using Lucene that leaves the default conjunction operator as OR,
I'm using Lucene.Net to implement a search website (to search PDFs). Once the keyword
Normally when using Lucene you set a search query and Lucene gives you some
Am building a Book search API using Lucene. I need to index Book Name,Author,
I'm using Lucene to search an index and it works fine. My only issue

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.