solrlucenesolrjspring-data-solr

Strange Solr spring behaviour


When I built my query with Spring data, it produce the following query:

http://localhost:8983/solr/pride_projects/select?q=accession:*PXD*+OR+accession:*PRD*+AND+publication_date:[2012\-12\-31T00\:00\:00.000Z+TO+2012\-12\-31T00\:00\:00.000Z]

This gives me no results. I have manually change the query in my Solr to:

http://localhost:8983/solr/pride_projects/select?q=accession:*PXD*+OR+accession:*PRD*+publication_date:[2012\-12\-31T00\:00\:00.000Z+TO+2012\-12\-31T00\:00\:00.000Z]

Here the output:

{ accession: "PXD000002", project_title: "The human spermatozoa proteome", project_description: "The human spermatozoa proteome was in depth characterized using shotgun iterative GeLC-MS/MS method with peptide exclusion lists.", project_sample_protocol: "This LC-MS/MS analysis was repeated twice by digested band using an identified peptide exclusion list, generated by Proteome Discoverer, from the previous LC-MS/MS runs of the same sample.", submission_date: "2012-01-02T00:00:00Z",

Removing the last AND and now the query works. I would expect similar behavior with both queries, but not.

Any ideas?


Solution

  • There is no reason the result should be the same when you remove an AND requirement - the default behavior for your setup is probably that all clauses are optional except when you are specific about requiring it (through AND).

    Since your publication_date interval only matches a single millisecond, it doesn't match any documents - so in your last query it's being ignored (and would affect score if a document matched).

    2012-12-31T00:00:00.000Z TO 2012-12-31T00:00:00.000Z
    

    .. the start of your interval is the same as the end of your interval, but since you used [ and ] (which means that the value itself is included) you would get a match for a document indexed with exactly that millisecond.

    You probably meant to filter for a far wider range.