Passa al contenuto principale
Supporto OCLC

Search/Facet

Find information related to Search/Facet.

Search/Facet is a service within DiscoverItem that is used to retrieve facets for an active search.

HTTP Method: GET


HTTP Method: POST  
HTTP Header Content-Type: "application/json" 


HTTP Header User-Agent: ${user-agent}  
Standard HTTP clients (browser, HTTP client libraries, etc.) will automatically include its User-Agent value.  

Search URL: 

https://HOSTNAME/di/search/facet

Search/Facet parameters

Parameter Name Definizione Required/Optional/etc. Nota
aid A valid authorization ID Richiesto Refer to authentication service for details.
query A valid Common Command Language - CCL (ISO 8777) query Richiesto

Refer to constructing CCL query for details

Use the same value for aid and query as used when calling the search service

num The number of values for each facet Opzionale If not provided, the default value of 15 will be used
name The facet to retrieve Opzionale

If not provided then all facets will be returned

Valid values:

  • author
  • catalog
  • data
  • medium
  • subject

Request body (HTTP Method: POST):

{
    "Catalog":[
        {
            "Name":"CatalogA"
        },
        {       
            "Name":"CatalogB"
        }, 
        {
            "Name":"..."
        }
    ]  
}                                                   

 

Example calls

Facets for a search with "aid" and "query" parameters
  • aid=12knsfd987234ldfd2
  • query=ti%3D%22The%20Stranger%22%20and%20au%3D%22Albert%22%20an d%20au%3D%22Camus%22
    { ti="The Stranger" and au="Albert" and au="Camus" }

https://HOSTNAME/di/search/facet?aid=12knsfd987234ldfd2&query=ti%3D%22The%20Stranger%22%20and%20au%3D%22Albert%22%20and%20au%3D%22Camus%22

Retrieve 15 (default) facet values for all facets for a search for The Stranger by Albert Camus.  

Facets for a search with "aid", query", and "num" parameters
  • aid=12knsfd987234ldfd2
  • query=ti%3D%22The%20Stranger%22%20and%20au%3D%22Albert%22%20an d%20au%3D%22Camus%22
    { ti="The Stranger" and au="Albert" and au="Camus" }
  • num=10

https://HOSTNAME/di/search/facet?aid=12knsfd987234ldfd2&query=ti%3D%22The%20Stranger%22%20and%20au%3D%22Albert%22%20and%20au%3D%22Camus%22n um=10

Retrieve 10 facet values for all facets for a search for The Stranger by Albert Camus. 

 Facets for a search with "aid", "query", "num", and "name" parameters
  • aid=12knsfd987234ldfd2
  • query=ti%3D%22The%20Stranger%22%20and%20au%3D%22Albert%22%20an d%20au%3D%22Camus%22
    { ti="The Stranger" and au="Albert" and au="Camus" }
  • num=20
  • name=date and medium

https://HOSTNAME/di/search/facet?aid=12knsfd987234ldfd2&query=ti%3D%22The%20Stranger%22%20and%20au%3D%22Albert%22%20and%20au%3D%22Camus%22& num=20&name=date&name=medium

Retrieve 20 facet values for date and medium facets for a search for The Stranger by Albert Camus.

Response

The response from this service is a JSON document.

Successful response request

The following is a sample response for a successful request (HTTP status 200 OK):

{
    "ActiveCatalog":0,
    "Facet":[
        {
            "Name":"author",
            "Entry":[
                {
                    "Value:"Author Name",
                    "Frequency":0
                }
            ]
        },
        {
            "Name":"date",
            "Entry":[
                {
                    "Value":"Publication Date"
                    "Frequency":0
                }
            ]
        },
        {
            "Name":"medium"
            "Entry":[
                {
                    "Value":"Medium"
                    "Frequency":18
                }
            ]
        },
        {
            "Name":"subject",
            "Entry":[
                {
                    "Value":"Subject",
                    "Frequency":0
                }
            ]
        },
        {
            "Name":"catalog",
            "Entry":[
                {
                    "Value":"Catalog Name",
                    "ItemCount":0
                }
            ]
        }
    ]
}                                                                                                                                                                                                                    

Response value glossary

Value Name Definizione
ActiveCatalog An integer value indicating the number of catalogs being actively searched. A value of 0 means that the search is complete.
Facet[n].Entry[n[.Frequency An integer value indicating the number of items with the same facet value.
Facet["catalog"].Entry[n].ItemCount An integer value indicating the number of items from that catalog.

Unsuccessful response request

The following is a sample response for an unsuccessful request.

{
    "Problem";  {
      "Code":"PUBHG004",
      "Message":"Inactive search"
    }
}        

Problem codes and messages glossary 

HTTP Status Codice Tipo Messaggio
400 Bad Request PUBSC002, PUBHG001 Pubblico Missing parameter
400 Bad Request PUBSC003 Pubblico Invalid parameter
401 Unauthorized PUBSC004 Pubblico Invalid aid
401 Unauthorized PUBSC006 Pubblico User group not authorized to access the service
404 Not Found PUBHG005 Pubblico No result
412 Precondition Failed PUBHG004 Pubblico Inactive search
500 Internal Server Error PRISC001, PRIHG001 Privato Internal error