Azure AI Search MultiIndex / Conditional Semantic search

I hope you’re having a great day. I’m currently working with Azure OpenAI to create a chatbot for retrieving data from massive enterprise textual data. At my editorial company, I’m facing a challenge with Azure AI Search. Initially, all the data was in a single index, but now I need to separate it into three different indices due to conditional search requirements. Here are the details:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Index 1: Biology Index (private, FR)
Index 2: Engineering and Technology Index (EN)
Index 3: Art and Architecture Index (USA, UK)
</code>
<code>Index 1: Biology Index (private, FR) Index 2: Engineering and Technology Index (EN) Index 3: Art and Architecture Index (USA, UK) </code>
Index 1: Biology Index (private, FR)
Index 2: Engineering and Technology Index (EN)
Index 3: Art and Architecture Index (USA, UK)

These indices contain various data sources and publications, and there is overlap in topics across them. For example, when querying about anatomy-related topics like eyesight, cardiovascular diseases, or growth hormone therapy, I want these queries, and related biological topics, to exclusively retrieve data from the Biology Index (Index 2).

My Python code effectively retrieves accurate data (with a one single index), but I’m looking for a solution within Azure AI Search to prioritize specific indices based on query context.

For example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Queries related to biology should exclusively retrieve data from indices 1 and 2.
Queries related to technology, data science, and AI should exclusively retrieve data from index 2.
</code>
<code>Queries related to biology should exclusively retrieve data from indices 1 and 2. Queries related to technology, data science, and AI should exclusively retrieve data from index 2. </code>
Queries related to biology should exclusively retrieve data from indices 1 and 2.

Queries related to technology, data science, and AI should exclusively retrieve data from index 2.

I haven’t come across a service or GitHub repository that directly addresses this specific requirement. I know that Azure does not allow multi-index search as it states here:

https://learn.microsoft.com/en-us/azure/search/search-faq-frequently-asked-questions#can-i-search-across-multiple-indexes-

I wask for thouse who have encountered this challenge or found a solution or work around ? I’m an active user and eager to collaborate. Please provide any information that could help me find a solution.

This is the code I use to RAG

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>index_name = 'indx-editorials-bio-fr-old'
# Query to execute
query = 'Please retrieve publications from editorial certified houses covering cardiovascular diseases'
# Function to execute the query with semantic ranking
def execute_query_with_semantic_ranking():
try:
# Create a SearchClient for the index
credential = AzureKeyCredential(admin_key)
client = SearchClient(endpoint=endpoint, index_name=index_name, credential=credential)
# Execute the query with semantic ranking
results = client.search(search_text=query, semantic_fields=["content", "title"])
# Print the results
print(f"Results from index '{index_name}' with semantic ranking:")
for result in results:
print(result)
print()
except Exception as e:
print(f"Error querying index '{index_name}' with semantic ranking: {e}")
# Execute the query with semantic ranking
execute_query_with_semantic_ranking()
</code>
<code>index_name = 'indx-editorials-bio-fr-old' # Query to execute query = 'Please retrieve publications from editorial certified houses covering cardiovascular diseases' # Function to execute the query with semantic ranking def execute_query_with_semantic_ranking(): try: # Create a SearchClient for the index credential = AzureKeyCredential(admin_key) client = SearchClient(endpoint=endpoint, index_name=index_name, credential=credential) # Execute the query with semantic ranking results = client.search(search_text=query, semantic_fields=["content", "title"]) # Print the results print(f"Results from index '{index_name}' with semantic ranking:") for result in results: print(result) print() except Exception as e: print(f"Error querying index '{index_name}' with semantic ranking: {e}") # Execute the query with semantic ranking execute_query_with_semantic_ranking() </code>
index_name = 'indx-editorials-bio-fr-old'

# Query to execute
query = 'Please retrieve publications from editorial certified houses covering cardiovascular diseases'

# Function to execute the query with semantic ranking
def execute_query_with_semantic_ranking():
    try:
        # Create a SearchClient for the index
        credential = AzureKeyCredential(admin_key)
        client = SearchClient(endpoint=endpoint, index_name=index_name, credential=credential)
        
        # Execute the query with semantic ranking
        results = client.search(search_text=query, semantic_fields=["content", "title"])
        
        # Print the results
        print(f"Results from index '{index_name}' with semantic ranking:")
        for result in results:
            print(result)
        print()
    
    except Exception as e:
        print(f"Error querying index '{index_name}' with semantic ranking: {e}")

# Execute the query with semantic ranking
execute_query_with_semantic_ranking()

Thank you!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật