pynequa.core

class pynequa.core.Sinequa(config: Dict)[source]

Bases: API

Sinequa API Client for Python

app_name

name of Sinequa app

Type:

str

query_name

name of search query web service

Type:

str

app_name: str
engine_sql()[source]
query_intent(intent_text: str) Dict[source]

This method evaluates SBA query intents from query intent sets.

Parameters:

intent_text (str) – indicates the text that should trigger query intent

Returns:

Query Intent response

Return type:

Dict

query_name: str
search_alerts()[source]
search_app(pre_login: bool = False, mode: str = 'debug') Dict[source]

This method retrieves SBA configuration before and after login.

Parameters:
  • pre_login (bool) – false by default.

  • mode (str) – debug by default (debug|release)

search_baskets()[source]
search_custom()[source]
search_dataset(parameters: Optional[Dict], datasets: Optional[List[str]]) Dict[source]

This method retrieves datasets through SQL queries. The response is a list of available datasets with their respective names and descriptions.

Parameters:
  • parameters (dict) – dictionary of parameters that can be used in SQL fragments

  • datasets (list) – list of datasets

Returns:

search dataset response

Return type:

Dict

search_labels()[source]
search_preview(query_params: QueryParams, action: str = 'get', origin: str = '', id: str = '') Dict[source]

This method retrieves preview data for a product.

Parameters:
  • query_params (QueryParams) – query params with text to be searched

  • action (str) – retrieves a preview object

  • origin (str) – server address of the SBA in browser used to load CSS

  • id (str) – id of document for which to retrieve the preview

Returns:

response for for Search Preview

Return type:

Dict

search_profile(profile_name: str, query_params: QueryParams, response_type: str = 'SearchCursor') Dict[source]

This method searches for Sienequa profile.

Parameters:
  • profile_name (str) – profile name

  • response_type (str) – default will be SearchCursor

  • query_params (QueryParams) – will carry query parameters in payload

Returns:

response data for Sinequa profile search.

Return type:

Dict

search_profile_subtree(profile: str, query_params: QueryParams, tree_params: TreeParams) Dict[source]

This method allows to select a subtree.

Parameters:
  • profile (str) – profile name

  • query_params (QueryParams) – search parameters

  • tree_params (TreeParams) – defines the sub-tree to retrieve

Returns:

returns subtree profile response

Return type:

Dict

search_query(query_params: QueryParams) Dict[source]

This method performs search query.

Parameters:

query_params (QueryParams) – query parameters as defined in QueryParams class

Returns:

response data of this request

Return type:

Dict

search_query_export(web_service: str, type: str, format: str, name: str, max_count: int) Dict[source]

This method allows exporting of search results in different formats.

Parameters:
  • web_service (str) – name of query export web service

  • type (str) – type of export to perform

  • format (str) – output format of export

  • name (str) – name of saved query to be exported (optional)

  • max_count (int) – maximum of number of documents to include in export(optiona)

Returns:

response for search export

Return type:

Dict

This method retrieves sponsored links for the passed query.

Parameters:

web_service (str) – name of corresponding sponsored links web service

Returns:

response for query links search

Return type:

Dict

search_ratings(action: str, docid: str, ratings_column: str, avg_column: str, ratings_distribution: List[str], rating: int, update_doc_weight: bool) Dict[source]

This method makes it possible to get, set and delete ratings associated with a document.

Parameters:
  • action (str) – get|set|delete

  • docid (str) – document id

  • ratings_column (str) – name of column in which to store rating

  • avg_column (str) – name of column to store average rating

  • ratings_distribution (List[str]) – array of possible ratings

  • rating (int) – sets the action parameter (optional)

  • update_doc_weight (bool) – indicates whether to update the doc weight according to rating (optional)

Returns:

response for ratings search

Return type:

Dict

search_recent_queries(action: str = 'load') Dict[source]

This method retrieves the current recent queries.

Parameters:

action (str) – Retrieve recent queries, default=load

Returns:

response for recent queries

Return type:

Dict

search_saved_queries()[source]
search_similardocuments(source_doc_id: str, query_params: QueryParams) Dict[source]

This method retrieves similar documents to a given document

Parameters:
  • source_doc_id (str) – identifier of document for which to retrieve similar documents

  • query_params (QueryParams) – query params

Returns:

search response for similar documents

Return type:

Dict

search_suggest()[source]
search_user_settings(action: str = 'load', user_settings: Dict = {}) Dict[source]

This method provides user settings

Parameters:
  • app_name (str) – name of application for which user setting should be handled

  • action (str) – search action (load|save|patch)

  • user_settings (Dict) – user settings to be saved or patched (see official

  • info) (documentation for more) –

Returns:

search response based upon action

Return type:

Dict

suggest_field()[source]

pynequa.models

class pynequa.models.AdvancedParams[source]

Bases: object

col_name: str = ''
col_value: str = ''
operator: str = ''
value: str = ''
class pynequa.models.OpenParams[source]

Bases: object

expression: str = ''
facet: str = ''
class pynequa.models.QueryParams[source]

Bases: object

action: str = ''
additional_select_clause: str = ''
additional_where_clause: str = ''
advanced: AdvancedParams = <pynequa.models.AdvancedParams object>
aggregations: List[str] = []
basket: str = ''
document_weight: str = ''
global_relevance: int = 0
group_by: str = ''
is_first_page: bool = False
name: str = ''
open_params: List[OpenParams] = []
order_by: str = ''
page: int = 0
page_size: int = 0
question_default_language: str = ''
question_language: str = ''
relevance_transforms: str = ''
remove_duplicates: bool = False
scope: str = ''
search_text: str = ''
select_params: List[SelectParams] = []
spelling_correction_filter: str = ''
spelling_correction_mode: str = ''
strict_refine: bool = False
tab: str = ''
text_part_weights: str = ''
class pynequa.models.SelectParams[source]

Bases: object

expression: str = ''
facet: str = ''
class pynequa.models.TreeParams[source]

Bases: object

box: str = ''
column: str = ''
op: str = ''
value: str = ''