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

  • Home
  • SEARCH
  • 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 8008815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:15:14+00:00 2026-06-04T18:15:14+00:00

Hy, I’ve noticed some differences when querying Solr with Java and PHP. The query

  • 0

Hy,

I’ve noticed some differences when querying Solr with Java and PHP. The query looks like this one here:

text:(www)+timestamp:[2012-04-16T00:00:00Z TO 2012-04-20T23:59:00Z]&q.op=AND&rows=0&sort=timestamp%20desc&facet=true&facet.field=terms_nouns_lemma&facet.limit=20&facet.method=enum

when printing out the number of documents found in Java

response.getResults().getNumFound()

I get almost 80.000, and the same in PHP

$response->response->numFound

returns around 7000. the PHP result seems to be more accurate as only a time frame needs to be considered (and due to the nature of the documents stored). But, when I go to the admin page and insert my query I again get around 80.000 (it’s the same value actually as with Java).

What am I missing here?

To me it seems that Java doesn’t consider the time frame at all? Maybe worth mentioning is that I’m using Solr 3.5 (and the Java library SolrJ is the corresponding version)

Note
I think this question is pretty much related, but it didn’t answer the question I have as it doesn’t take restrictions into considerations (as the time frame in the query above).

Additionally
in PHP, if I don’t set the number of rows I want to have in my response, it actually returns the correct amount of documents that were found, is there any equivalent in Java w/ SolrJ (per default, if row isn’t set, it will be set to 10, setting it to -1 isn’t working either)

Thanks for any hints

Update

as posted in the comments below the difference in the query is that SolrJ replaces a blank/space with a “+”, I tried escaping it hardcoded and with the use of ClientUtils.escapeQueryChars(String), but both didn’t work as expected

What’s really funny as well:

text:(www)&facet.range=timestamp&f.timestamp.facet.range.end=2012-04-16T21:59:59.000Z&f.timestamp.facet.range.gap=+1MINUTE&rows=0

returns the same number of documents as

text:(www)
  • 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-04T18:15:15+00:00Added an answer on June 4, 2026 at 6:15 pm

    Have you validated that the query being executed against the solr index is the same for both the SolrJ and PHP queries? Especially considering that you are saying the SolrJ query is not limiting by the date range you have specified. That would make me suspicious that something is not being setup/passed correctly from SolrJ.

    Also with regard to returning all the rows, you can set the rows within SolrJ to an absurdly large number (around 100,000) should work in this case for you, based on your counts.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.