hydroshare / hsclient

A python client for interacting with HydroShare in an object oriented way.

Home Page:https://hydroshare.github.io/hsclient/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is search by subjects using AND or OR ?

huard opened this issue · comments

Testing suggests it's using OR, but it would nice to have confirmation in the docs. Is there a way to refine search with AND ?
And is it the same for full_text_search?

Not that im aware of, @huard. The search method is calling HydroShare's /hsapi/resource/ rest api endpoint. To my knowledge, it uses OR as you mentioned. Here is HydroShare's swagger documentation as a second reference. @sblack-usu, can you confirm that?

There is not an and option for that endpoint. It is a search endpoint that was written a long time ago for basic searches. If you need something more involved, you could hit the haystack endpoint. We use drf-haystack to expose the full solr search capabilities through the rest api. I hooked it up years ago and I don't think anyone has used it because the basic search is easier to get started with and has met user needs.

If you would like to use it, here are the docs on how to create queries.
https://drf-haystack.readthedocs.io/en/latest/01_intro.html#query-time

The endpoint is /hsapi/resource/search. The request/response models for that endpoint are fully documented on the swagger page that Austin linked. You should be able to craft any query you'd like with that endpoint but it is more difficult and not integrated with hsclient.

As I said, nobody has used this endpoint. I was looking it over and testing it out today and saw that the resource id is not returned with the results. I filed an issue, it is easily resolved.