You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/api/search.rst
+20-11Lines changed: 20 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ metadata_fields string Includes the requested fields for each dataset in the
41
41
geo_point string Latitude and longitude in the form ``geo_point=42.3,-71.1``. You must supply ``geo_radius`` as well. See also :ref:`geospatial-search`.
42
42
geo_radius string Radial distance in kilometers from ``geo_point`` (which must be supplied as well) such as ``geo_radius=1.5``.
43
43
show_type_counts boolean Whether or not to include total_count_per_object_type for types: Dataverse, Dataset, and Files.
44
-
search_service string The name of the search service to use for this query. If omitted, the default search service will be used. For available search services, see :ref:`search-services-api`.
44
+
search_service string The name of the search service to use for this query. If omitted, the default search service will be used. For available search services, see :ref:`discovering-available-search-services`.
45
45
================ ======= ===========
46
46
47
47
Basic Search Example
@@ -779,15 +779,20 @@ Output from iteration example
779
779
CORS
780
780
</span>
781
781
782
-
.. _search-services-api:
782
+
.. _search-services:
783
783
784
-
Search Services API
785
-
-------------------
784
+
Search Services
785
+
---------------
786
+
787
+
.. _discovering-available-search-services:
788
+
789
+
Discovering Available Search Services
790
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
786
791
787
792
To discover available search services and their capabilities, you can use the Search Services API endpoint.
788
793
Note: Configurable Search Services are an optional, experimental feature than may evolve faster than other parts of Dataverse.
Example API endpoint: https://demo.dataverse.org/api/search/services
791
796
792
797
This endpoint returns a list of available search services, including their names, display names, and any additional information about their capabilities.
793
798
@@ -804,21 +809,25 @@ Example response:
804
809
},
805
810
{
806
811
"name": "externalSearch",
807
-
"displayName": "AI Search for Datasets",
812
+
"displayName": "External Search for Datasets",
808
813
}
809
814
]
810
815
}
811
816
812
-
You can use the `name` values returned by this endpoint in the `search_service` parameter of the main search API to specify which search service to use for a particular query.
817
+
You can use the ``name`` values returned by this endpoint in the ``search_service`` parameter of the main search API to specify which search service to use for a particular query.
813
818
814
819
Using Different Search Services
815
-
-------------------------------
820
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
816
821
817
-
To use a specific search service, include the `search_service` parameter in your search query. For example:
822
+
To use a specific search service, include the ``search_service`` parameter in your search query and pass the ``name``. For example:
This query will use the externalSearch service (assuming it exists) instead of the default search service.
826
+
This query will use the ``externalSearch`` service (assuming it exists) instead of the default search service (``solr``).
827
+
828
+
.. note:: Other search services may not be complete replacements for the included ``solr`` service. For example, they may not support searching for collections or files (just datasets).
822
829
823
-
.. note:: Other search services may not be complete replacements for the included solr service. For example, they may not support searching for collections or files (just datasets).
830
+
Developing Search Services
831
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
824
832
833
+
See :doc:`/developers/search-services` in the Developer Guide.
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/developers/search-services.rst
+35-23Lines changed: 35 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,23 @@
1
1
Search Services
2
2
===============
3
-
Dataverse now supports configurable search services, allowing developers to integrate new search engines dynamically. This guide outlines the design and provides details on how to use the interfaces and classes involved.
3
+
4
+
Dataverse supports configurable search services, allowing developers to integrate additional search engines dynamically. This guide outlines the design and provides details on how to use the interfaces and classes involved.
5
+
4
6
Design Overview
5
7
---------------
6
8
The configurable search services feature is designed to allow:
9
+
7
10
1. Dynamic addition of new search engines
8
11
2. Configuration of the Dataverse UI to use a specified search engine
9
12
3. Use of different search engines via the API
10
13
4. Discovery of installed search engines
14
+
11
15
Key Components
12
16
--------------
17
+
13
18
1. SearchService Interface
14
19
^^^^^^^^^^^^^^^^^^^^^^^^^^
15
-
The ``SearchService`` interface is the core of the configurable search services. It defines the methods that any search engine implementation must provide.
20
+
The ``SearchService`` interface is the core of the configurable search services. It defines the methods that any search engine implementation must provide. (The methods below are accurate as of this writing.)
16
21
17
22
.. code-block:: java
18
23
@@ -28,9 +33,9 @@ The ``SearchService`` interface is the core of the configurable search services.
The interface allows you to provide a service name and display name, and to respond to the same search parameters that are normally sent to the solr search engine.
36
+
The interface allows you to provide a service name and display name, and to respond to the same search parameters that are normally sent to the Solr search engine.
32
37
33
-
The setSolrSearchService method is used by Dataverse to give your class a reference to the SolrSearchService, allowing your class to perform solr queries as needed. (See the ExternalSearchServices for an example.)
38
+
The ``setSolrSearchService`` method is used by Dataverse to give your class a reference to the ``SolrSearchService``, allowing your class to perform Solr queries as needed. (See the ``ExternalSearchServices`` for an example.)
34
39
35
40
2. ConfigurableSearchService Interface
36
41
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -43,15 +48,15 @@ The ``ConfigurableSearchService`` interface extends the ``SearchService`` interf
The GetExternalSearchServiceBean and PostExternalSearchServiceBean classes provide a use case for this.
51
+
The ``GetExternalSearchServiceBean`` and ``PostExternalSearchServiceBean`` classes provide a use case for this.
47
52
48
53
3. JVM Options for Search Configuration
49
54
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
55
Dataverse uses two JVM options to configure the search functionality:
51
56
52
-
- ``dataverse.search.services.directory``: Specifies the local directory where jar files with search engines (classes implementing the SearchService interface) can be found. Dataverse will dynamically load engines from this directory.
57
+
- ``dataverse.search.services.directory``: Specifies the local directory where jar files with search engines (classes implementing the ``SearchService`` interface) can be found. Dataverse will dynamically load engines from this directory.
53
58
54
-
- ``dataverse.search.default-service``: The serviceName of the service that should be used in the Dataverse UI.
59
+
- ``dataverse.search.default-service``: The ``serviceName`` of the service that should be used in the Dataverse UI.
55
60
56
61
Example configuration:
57
62
@@ -65,9 +70,11 @@ Remember to restart your Payara server after modifying these JVM options for the
65
70
4. Using Different Search Engines via API
66
71
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67
72
68
-
The loaded search services can be discovered using the /api/search/services endpoint.
73
+
The loaded search services can be discovered using the ``/api/search/services`` endpoint.
69
74
70
-
Queries can be made to different engines by including the optional search_service=<serviceName> query parameter.
75
+
Queries can be made to different engines by including the optional ``search_service=<serviceName>`` query parameter.
76
+
77
+
Use of these endpoints is described for end users in the API Guide under :ref:`search-services`.
71
78
72
79
Available Search Services
73
80
-------------------------
@@ -91,18 +98,23 @@ or
91
98
2. PostExternalSearchServiceBean
92
99
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93
100
94
-
These classes implement the ConfigurableSearchService interface.
101
+
These classes implement the ``ConfigurableSearchService`` interface.
95
102
They make a GET or POST call (respectively) to an external search engine that must return a JSON array of objects with "DOI" and "Distance" keys.
96
103
The query sent to the external engine use the same query parameters as the Dataverse search API (GET) or have a JSON payload with those keys (POST).
97
104
The results they return are then searched for using the solr search engine which enforces access control and provides the standard formatting expected by the Dataverse UI and API.
98
-
The Distance values are used to order the results, smallest distances first.
105
+
The distance values are used to order the results, smallest distances first.
106
+
107
+
They can be configured via two settings each:
108
+
109
+
- GET
110
+
111
+
- :GetExternalSearchUrl - the URL to send GET search queries to
112
+
- :GetExternalSearchName - the display name to use for this configuration
113
+
114
+
- POST
99
115
100
-
They can be cofigured via 2 settings each:
101
-
:GetExternalSearchUrl - the URL to send GET search queries to
102
-
:GetExternalSearchName - the display name to use for this configuration
103
-
104
-
:PostExternalSearchUrl - the URL to send POST search queries to
105
-
:PostExternalSearchName - the display name to use for this configuration
116
+
- :PostExternalSearchUrl - the URL to send POST search queries to
117
+
- :PostExternalSearchName - the display name to use for this configuration
106
118
107
119
As these classes use DOIs as identifiers, they cannot reference collections or, unless file DOIs are enabled, files.
108
120
Similar classes, or extensions of these classes could search by database ids instead, etc. to support the additional types.
@@ -113,17 +125,17 @@ Similar classes, or extensions of these classes could search by database ids ins
113
125
4. OddlyEnoughSearchServiceBean
114
126
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115
127
116
-
These classes implement the SearchService interface.
128
+
These classes implement the ``SearchService`` interface.
117
129
They are intended only as code examples and simple tests of the design and are not intended for production use.
118
130
The former simply replaces the user query with a query for entities with a db id < 1000. It demonstrates how a class can leverage the solr engine and achieve results solely by modifying/replacing the user query.
119
-
The latter only returns hits from the user's query that also have an odd database id. Since the filtering in the class changes the number of total hits available and pagination, this class demonstrates one way a developer can adjust those aspects of the solr response.
131
+
The latter only returns hits from the user's query that also have an odd database id. Since the filtering in the class changes the number of total hits available and pagination, this class demonstrates one way a developer can adjust those aspects of the Solr response.
120
132
121
133
Notes
122
134
-----
123
135
124
-
1. Unless you use the solr engine to provide access control, you must implement proper access control in your search engine
125
-
2. The design currently limits search results to be in the format returned by solr and the hits are expected to be collections, datasets, or files - other classes are not supported.
126
-
3. Search services could be designed to completely replace solr or to just support certain use cases (e.g. the external search classes only handling datasets).
136
+
1. Unless you use the Solr engine to provide access control, you must implement proper access control in your search engine
137
+
2. The design currently limits search results to be in the format returned by Solr and the hits are expected to be collections, datasets, or files - other classes are not supported.
138
+
3. Search services could be designed to completely replace Solr or to just support certain use cases (e.g. the external search classes only handling datasets).
127
139
4. While search services can be deployed as independent jar files, they currently import multiple Dataverse classes and, unlike exporters, cannot be built using just the Dataverse SPI.
128
-
5. As with other experimental features, we expect the SearchService interface may change over time as we learn about how people use it. Please keep in touch if you are developing search services.
140
+
5. As with other experimental features, we expect the ``SearchService`` interface may change over time as we learn about how people use it. Please keep in touch if you are developing search services.
0 commit comments