‘Tìm kiếm nhận thức Azure’ – vấn đề về cấu hình ‘trường’

lập trình


Tôi đang nghiên cứu xây dựng một công cụ tìm kiếm ngữ nghĩa bằng cách sử dụng ‘Tìm kiếm nhận thức Azure’. Tôi đã tải lên tập dữ liệu Excel của mình theo cách lập trình bằng Python.

Để tìm kiếm và chạy truy vấn, mỗi trường/cột trong tập dữ liệu Excel có thể được liên kết với các tính năng như ‘có thể tìm kiếm’, ‘có thể sắp xếp’, ‘có thể truy xuất’, ‘có thể lọc’, & ‘có thể phân loại’.

Tôi đã thử chọn các tính năng này cho các trường/cột trong tập dữ liệu của mình nhưng bằng cách nào đó chúng bị vô hiệu hóa. Chỉ có thể chọn tùy chọn ‘có thể truy xuất’. Tôi đã thử cả lập trình và thủ công. Cả hai phương pháp này đều không hoạt động.

GHI CHÚ: Tôi đang sử dụng phiên bản dùng thử miễn phí. Không chắc điều này có gây ra sự cố hay không, nhưng tài liệu cho biết, “có thể truy xuất” không ảnh hưởng đến kích thước chỉ mục. “có thể lọc”, “có thể sắp xếp”, “có thể đối diện” tiêu tốn nhiều bộ nhớ hơn”. Ngoài ra, dữ liệu của tôi rất nhỏ với 8 hàng và 10 cột, chủ yếu là số và văn bản một từ.

Những gì tôi đã thử:

Mã Python của tôi để chọn các tính năng:

Python
import pandas as pd
import json
from azure.search.documents.indexes.models import SimpleField, SearchFieldDataType
import os
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient 
from azure.search.documents import SearchClient

df_azure=pd.read_excel("C:/stats.xlsx")

endpoint="https://azure-service.search.windows.net"
key="q5EMEa0at5VJRvwTVlkqWhvHSKs"

SearchIndexClient=SearchIndexClient(endpoint, AzureKeyCredential(key))
indexName="indexes-azure"

from azure.search.documents.indexes.models import (
    ComplexField,
    CorsOptions,
    SearchIndex,
    ScoringProfile,
    SearchFieldDataType,
    SimpleField,
    SearchableField
)

fields=[
     SearchableField(name="rule_name", type=SearchFieldDataType.String, 
                     facetable=True, filterable=True, sortable=True),
     SearchableField(name="rule_description", type=SearchFieldDataType.String, 
                     facetable=True, filterable=True, sortable=True),
     SearchableField(name="Date_of_execution", 
                     type=SearchFieldDataType.String, facetable=True, 
                     filterable=True, sortable=True),
     SearchableField(name="Data_Source", type=SearchFieldDataType.String, 
                     facetable=True, filterable=True, sortable=True),  
     SearchableField(name="Total_no_of_records", 
                     type=SearchFieldDataType.String, 
                     facetable=True, filterable=True, sortable=True),
     SearchableField(name="No_of_failed_records", 
                     type=SearchFieldDataType.String, facetable=True, 
                     filterable=True, sortable=True)
] 
  
indexConfig= SearchIndex(name=indexName,
                         fields=fields,
                         scoring_profiles=[],
                         cors_options= CorsOptions(allowed_origins=["*"], 
                         max_age_in_seconds=60))

index=SearchIndexClient.create_index(indexConfig)

SearchClient = SearchClient(endpoint, indexName, AzureKeyCredential(key))
result = SearchClient.upload_documents(documents=DOCUMENTS)
print("DOCUMENT upload successful: {}".format(result[0].succeeded))
Output: DOCUMENT upload successful: True

Giải pháp 1

Bạn đang gặp phải sự cố trong đó chỉ có thể chọn thuộc tính ‘có thể truy xuất’ cho các trường trong chỉ mục Tìm kiếm nhận thức Azure của bạn, trong khi các thuộc tính khác như ‘có thể tìm kiếm’, ‘có thể sắp xếp’, ‘có thể lọc’ và ‘có thể phân loại’ bị tắt.

Điều này có thể liên quan đến những hạn chế ở cấp độ miễn phí của Tìm kiếm nhận thức Azure. Mặc dù tài liệu đề cập rằng các thuộc tính như ‘có thể lọc’, ‘có thể sắp xếp’ và ‘có thể phân loại’ tiêu tốn nhiều bộ nhớ hơn nhưng tài liệu không nêu rõ rằng chúng bị vô hiệu hóa đối với các bậc miễn phí.

Tôi gặp phải vấn đề tương tự.

コメント

タイトルとURLをコピーしました