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:
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:
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
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!