NASA-PDS / registry-api

Web API service for the PDS Registry, providing the implementation of the PDS Search API (https://github.com/nasa-pds/pds-api) for the PDS Registry.
https://nasa-pds.github.io/pds-api
Apache License 2.0
3 stars 5 forks source link

`q=` query with `or` does not work as expected #520

Closed tloubrieu-jpl closed 2 months ago

tloubrieu-jpl commented 3 months ago

Checked for duplicates

No - I haven't checked

πŸ› Describe the bug

I tried to query my local pds registry with:

GET /products?q=((pds:Target_Identification.pds:name eq "Moon") or (cart:Geodetic_Model.cart:spheroid_name eq "MOON"))&limit=10000

And expected to see all labels with Moon target name or MOON spheroid name. However, I instead got no data at all. Each of these alone produced what I expected, ~1000 for target name and ~285 for spheroid name.

After adding the target name tags to the lola xml, I got back only the lola xml. So it seems like or is functioning as and.

πŸ•΅οΈ Expected behavior

I expected to get back around 1283 responses.

πŸ“œ To Reproduce

  1. Create treks and lola pds4 xml from the commands in the registry. Lola command is not merged, but on branch stac_utility

  2. load the xml files into the registry

  3. go to or curl http://localhost:8080/products?q=((pds:Target_Identification.pds:name eq "Moon") or (cart:Geodetic_Model.cart:spheroid_name eq "MOON"))&limit=10000

πŸ–₯ Environment Info

Version of this software stac_utility branch of registry Operating System: Intel Macbook

πŸ¦„ Related requirements

TBD

alexdunnjpl commented 2 months ago

@tloubrieu-jpl do you still have this environment set up? I was hoping you might be able to test with an up-to-date version of registry-api before I dive into trying to replicate - the following initial tests against the I&T database init indicate that OR/or is working as intended.

With two bundles, four collections:

http://localhost:8081/products?q=((product_class EQ "Product_Collection") or (product_class EQ "Product_Bundle")) returns 6

http://localhost:8081/products?q=((product_class EQ "Product_Collection") and (product_class EQ "Product_Bundle")) returns 0

alexdunnjpl commented 2 months ago

Confirmed working as-expected on production API, too:

534 Bundle 1992 Collection 1992 Collection or Collection 1992 Collection OR Collection 2526 Bundle Or Collection

alexdunnjpl commented 2 months ago

Running original query against prod registry/API

A - https://pds.mcp.nasa.gov/api/search/1/products?q=(pds:Target_Identification.pds:name eq "Moon") returns 2822398 B -https://pds.mcp.nasa.gov/api/search/1/products?q=(cart:Geodetic_Model.cart:spheroid_name eq "MOON") returns 288

A or B returns 2822398 A and B returns 288

So behaviour is as-expected

alexdunnjpl commented 2 months ago

Closing as not-a-bug after confirming with @tloubrieu-jpl

c-suh commented 3 days ago

Because this wasn't reproduced, it is not a bug and should be "skip i&t"