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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:49:46+00:00 2026-06-05T15:49:46+00:00

I am trying the following query and get only zero results (I am supposed

  • 0

I am trying the following query and get only zero results (I am supposed to get 10 results according to my dataset)

http://mymachine:8983/solr/select/?q=-(HOSTID:302)

I also tried the below query and got zero results yet again.

http://mymachine:8983/solr/select/?q=NOT(HOSTID:302)

However, I get 10 results(expected) when I put the query this way,

http://mymachine:8983/solr/select/?q=-(HOSTID:302)AND(*:*)

Why is this strange thing happening? Is it a bug in solr or am I missing something?

  • 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-06-05T15:49:48+00:00Added an answer on June 5, 2026 at 3:49 pm

    Ahmet Arslan from the solr mailing list helped me with a solution. Just mentioning it here for future benefits.

    Solr converts top level negative query (-field:something) into q=+: -field:something

    It seems that you are missing that part.

    org.apache.solr.search.QueryUtils

    `/** Fixes a negative query by adding a MatchAllDocs query clause.
      * The query passed in *must* be a negative query.
      */
     public static Query fixNegativeQuery(Query q) {
       BooleanQuery newBq = (BooleanQuery)q.clone();
       newBq.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
       return newBq;
     }`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get row count from the following query. I get only
I'm trying to get the following query to work in Hibernate: SELECT m FROM
I'm trying the following query results = Tickets.order(created_at DESC).where({ (title =~ params[:title]) & (name
I am trying to execute the following Query select distinct pincode as Pincode,CAST(Date_val as
What I'm trying to do is the following:- Query my database to show only
I'm trying to do the following query in Linq SELECT * FROM Table1 T1
I'm trying to do a query in hibernate like the following sql query: SELECT
i'm trying the following MySQL query to fetch some data: SELECT m.*, t.* FROM
I am trying to code the following query using Zend_Db api's: select * from
I am trying to translate the following query into entity framework: SELECT Subjects.Name FROM

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.