spraakbanken / karp-backend

Karp backend
MIT License
3 stars 2 forks source link

Searching in fields that do not exist #284

Open majsan opened 3 months ago

majsan commented 3 months ago

Searching in a field that does not exist works: equals|non_configured_field|3 simply returns zero hits.

However, if there is a path to the field equals|path.non_configured_field||3 it will only behave the same way if path exists. If a part of path does not exist, we get a 500 Internal server error.

The bad error should be replaced with a more descriptive one. I also think that the first case should fail if the resource has additionalProperties: false. Since this setting requires that all fields be specified in the configuration, a query on a field that is not in the configuration would always fail and it would be easier for users if this was made clear.

nick8325 commented 2 months ago

Now it at least doesn't crash on equals|path.non_configured_field|3. Leaving this open though since as you say we probably should crash if additionalProperties: false is given.