Retrieve Search Settings
Retrieves the search related settings of the project
HTTP Request
GET/api/search/search
Authorization
Authorization
- Required: Yes
- Permission: Staff with SearchSettingsPermission or Admin
- Permission Code: 1046
- Authentication: Token authentication
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Retrieve search settings
4response = requests.get('http://www.example.com/api/settings/search',
5 headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())1# Retrieve search settings
2curl "http://www.example.com/api/settings/search" -H "Authorization: Token <your_api_key>"Response Fields
| Field | Type | Description |
|---|---|---|
| core_product_searchable_fields | Array[String] | an array of strings defining which fields of the product are searchable in the panel |
| shop_product_searchable_fields | Array[String] | an array of strings defining which fields of the product are searchable in the shop |
| stop_words_list | Array[String] | an array of words that are ignored in the search results |
| ngram_min_limit | Integer | defines the minimum tokenizing length of words used in elastic indexing |
| ngram_max_limit | Integer | defines the maximum tokenizing length of words used in elastic indexing |
Example Response
{
"core_product_searchable_fields": [
"title",
"title.ngram"
],
"shop_product_searchable_fields": [
"title",
"title.ngram"
],
"stop_words_list": [
"و",
"در",
"به",
],
"ngram_min_limit": 2,
"ngram_max_limit": 10
}
Notes
- List of available fields to be used as
product_searchable_fieldsare:- title
- title.ngram
- code
- code.ngram
- id
- slug
- excerpt
- excerpt.ngram
- The ngram postfix in the fields defines if we need ngram searching. Consider a word 'vitrin' is indexed in the elastic database.
If ngram searching is also enabled, the search will also be done over
vi,vit,vitr,vitri,vitrintokens with typo tollerance and the results become more fuzzy. stop_words_listare the words that are not indexed in the elastic database. For example we usually do not need to index the word 'که' in persian and also the searches over that word are useless. There is a default list of stop words which the user can modify.
DEFAULT_STOP_WORDS_LIST = [
"و", "در", "به", "از", "که", "می", "این", "است", "را", "با", "های", "برای", "آن", "شود", "شده", "خود", "ها", "کرد",
"شد", "ای", "تا", "کند", "بر", "بود", "گفت", "نیز", "وی", "هم", "کنند", "دارد", "ما", "کرده", "یا", "اما", "باید",
"اند", "هر", "خواهد", "او", "مورد", "آنها", "باشد", "دیگر", "مردم", "نمی", "بین", "پیش", "پس", "اگر", "همه", "صورت",
"یکی", "هستند", "بی", "من", "دهد", "نیست", "استفاده", "داد", "داشته", "راه", "داشت", "چه", "همچنین", "کردند",
"داده", "بوده", "دارند", "همین", "سوی", "شوند", "بیشتر", "بسیار", "روی", "گرفته", "هایی", "تواند", "هیچ", "چند",
"بیش", "شدن", "کردن", "کنیم", "نشان", "حتی", "اینکه", "ولی", "توسط", "چنین", "برخی", "نه", "دیروز", "دوم", "درباره",
"بعد", "مختلف", "گیرد", "شما", "گفته", "آنان", "بار", "طور", "گرفته", "دهند", "گذاری", "بسیار", "طی", "بودند",
"کل", "تر", "براساس", "شدند", "ترین", "باشند", "ندارد", "چون", "قابل", "گوید", "دیگری", "همان", "خواهند", "قبل",
"آمده", "اکنون", "تحت", "طریق", "گیری", "جای", "هنوز", "چرا", "البته", "کنید", "سازی", "سوم", "کنیم", "بلکه", "زیر",
"توانند", "ضمن", "فقط", "بودن", "حق", "آید", "وقتی", "اش", "یابد", "نخستین", "مقابل", "خدمات", "امسال", "تاکنون",
"مانند", "آورد", "فکر", "آنچه", "نخست", "نشده", "شاید", "ساخته", "زیرا", "برداری", "کسی", "ریزی", "رفت", "گردد",
"مثل", "آمد", "ام", "دانست", "کمتر", "دادن", "تمامی", "جلوگیری", "بیشتری", "ایم", "ناشی", "چیزی", "آنکه",
"بنابراین", "ایشان", "بعضی", "دادند", "داشتند", "برخوردار", "نخواهد", "هنگام", "نباید", "غیر", "نبود", "دیده", "وگو",
"داریم", "چگونه", "بندی", "خواست", "فوق", "ده", "نویی", "هستیم", "دیگران", "همچنان", "ندارند", "روزهای", "آنجا",
"یکدیگر", "کردم", "بیست", "بروز", "سپس", "رفته", "آورده", "نمایید", "باشیم", "گویند", "خویش", "همواره", "گذشته",
"نداشته", "شناسی", "خواهیم", "آباد", "داشتن", "نظیر", "همچون", "باره", "نکرده", "شان", "دانند", "جایی", "بی", "جز",
"نزدِ", "نزدیکِ", "دنبالِ", "حدودِ", "مانندِ", "ضدِ", "هنگامِ", "برایِ", "مثلِ", "باره", "اثرِ", "تولِ", "علتِ", "قصدِ", "روب",
"جدا", "کی", "که", "چیست", "هست", "کجا", "کجاست", "کَی", "چطور", "کدام", "آیا", "مگر", "چندین", "یک", "چیزی", "دیگر",
"کسی", "بعری", "هیچ", "چیز", "جا", "کس", "هرگز", "یا", "تنها", "بلکه", "خیاه", "بله", "بلی", "آره", "آری", "مرسی",
"البته", "لطفاًً", "ها", "انکه", "وقتیکه", "همین", "پیش", "مدتی", "هنگامی", "مان", "تان"
]