Search Service Examples
Initial Search Without Any Facet Enabled
Issue a post request with an empty JSON object will trigger the default search action for the 10 most recent documents without facet information.
|
This is the default behavior of the default Graph Search Web UI when a user logs in. 10 most recent documents are retrieved with all facets enabled and configured by the thesaurus project. By including identifiers of facets into "facets"
field, facet information of the search result will also be returned for the requested facets.
|
|
Number of search results per page and pagination can be configured via "start"
and "count"
, which is equivalent to the concept of "offset"
and "limit"
in SQL and SPARQL. The following request retrieves 5 documents after 15 preceding matching documents.
|
|
A user may choose a facet member from the facet list of the previous search result to further refine his search result to include at least the selected facet member. The following search request will retrieve documents which have at least the concept of "Vodka" represented by URI http://vocabulary.semantic-web.at/cocktails/22df810d-e509-4da8-979c-0758e94de3e6 mentioned.
|
|
More facet members can be selected from the previous search result to further refine the search result to reach desired outcome. For example, a user can find documents related to Cocktail Mojito, Beverage Vodka and Glassware Mug.
|
|
The previous example find documents at least matching all three filters at the same time. But search filters can also be optional, by setting the "optional"
attribute of a search filter to true
. The following example will find documents including "Mojito" and "Vodka" or "Mug".
|
|
Traditional full text search on the text field of document is also supported by using a reserved attribute "dyn_txt_content"
in a search filter. For example, search for documents with content matching keyword "Vodka". Search with multiple full text search filters and multiple faceted search filters are supported as well by appending more search filters.
|
|
By default documents appear in search results in descending order according to the creation time. It is also possible to order by title alphabetically with "sort"
attribute.
|
|
By default facet information are flat lists. For each facet the top 10 most frequently used facet members for the collection of documents qualifying for the search query are returned in the search result. All facet members belonging to a facet are used without considering the hierarchy of facet members. By setting "facetMode"
of a facet to "tree"
in the search request will retrieve facet information organized in a hierarchical structure identical to its definition in the thesaurus project.
|
|
In addition to the default attributes created automatically in the search index for each document, custom attributes can also be created at document creation time, which can be further used in search results for any business logic. For example, if a document about a cocktail with custom attributes "dyn_flt_abv", "
dyn_lit_countryOfOrigin", "dyn_txt_ingredients", "
dyn_lit_modifiedDate" defined for Alcohol by volume, country of origin, ingredients and modification date of the document is created and indexed, one can retrieve the aforementioned custom attributes as well by using "customAttributes"
field in the request. Note that all custom attributes are optional.
|
|
Only available for Solr based Graph Search.
If Solr is used as backend of Graph Search, it is possible to provide a native Solr query as a filter of the search request via attribute "nativeQuery"
. This brings in other Solr features for many use cases. For example, one can perform a full text search with wildcards.
|
|
Only available for Solr based Graph Search.
It is also possible to take advantage of Solr native queries and custom attributes to formulate complex search query. For example, search for documents with attribute "dyn_flt_abv"
between 0 and 0.5, attribute "dyn_txt_ingredients"
containing keyword "soda"
and modification date after January 1st 2017:
|
|