Skip to content

Commit

Permalink
Rename text to keyword search
Browse files Browse the repository at this point in the history
  • Loading branch information
jelledruyts committed Oct 25, 2023
1 parent f6e8afa commit 17b9940
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## About

This project provides a very easy to use learning and experimentation playground to try out various AI-enabled search scenarios in Azure. It provides a web application front-end which uses [Azure Cognitive Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) and [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) to execute searches with a variety of options - ranging from simple text search, to semantic search, vector and hybrid search, and using generative AI to answer search queries in various ways. This allows you to quickly understand what each option does, how it affects the search results, and how various approaches compare against each other.
This project provides a very easy to use learning and experimentation playground to try out various AI-enabled search scenarios in Azure. It provides a web application front-end which uses [Azure Cognitive Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) and [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) to execute searches with a variety of options - ranging from simple keyword search, to semantic search, vector and hybrid search, and using generative AI to answer search queries in various ways. This allows you to quickly understand what each option does, how it affects the search results, and how various approaches compare against each other.

By default, a few documents are added automatically to allow you to use the application directly. You're encouraged to upload your own documents (which you can also easily do via the web app) so you can experiment with searching over your own content.

There are a number of related and somewhat similar projects, most notably the following:

- ["Chat with your data" Solution Accelerator](https://aka.ms/ChatWithYourDataSolutionAccelerator)
- [ChatGPT + Enterprise data with Azure OpenAI and Cognitive Search](https://github.com/Azure-Samples/azure-search-openai-demo) (demo)
- [ChatGPT + Enterprise data with Azure OpenAI and Cognitive Search](https://aka.ms/EntGPTSearch) (demo)
- [Azure Chat Solution Accelerator powered by Azure Open AI Service](https://github.com/microsoft/azurechat)
- [Sample Chat App with Azure OpenAI](https://github.com/Microsoft/sample-app-aoai-chatGPT) (sample)

Expand Down
32 changes: 16 additions & 16 deletions src/Azure.AISearch.WebApp/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
var mermaidDiagram = '';
mermaidDiagram += 'create participant ACS as Azure Cognitive Search\n';
if (queryType == '@QueryType.TextStandard' || queryType == '@QueryType.TextSemantic') {
// Pure text search.
mermaidDiagram += `${sourceParticipant}->>ACS: Search using text\n`;
// Pure keyword search.
mermaidDiagram += `${sourceParticipant}->>ACS: Search using keywords\n`;
mermaidDiagram += `create participant Index as ${searchIndex} Index\n`;
mermaidDiagram += `ACS->>Index: Search using text\n`;
mermaidDiagram += `ACS->>Index: Search using keywords\n`;
mermaidDiagram += 'destroy Index\n';
mermaidDiagram += 'Index-xACS: Text search results\n';
mermaidDiagram += 'Index-xACS: Keyword search results\n';
}
else if (queryType == '@QueryType.Vector') {
// Pure vector search.
Expand All @@ -70,14 +70,14 @@
}
else if (queryType == '@QueryType.HybridStandard' || queryType == '@QueryType.HybridSemantic') {
// Hybrid search.
mermaidDiagram += `${sourceParticipant}->>ACS: Search using vector and text\n`;
mermaidDiagram += `${sourceParticipant}->>ACS: Search using vector and keywords\n`;
mermaidDiagram += `create participant Index as ${searchIndex} Index\n`;
mermaidDiagram += `ACS->>Index: Search using vector\n`;
mermaidDiagram += 'Index->>ACS: Vector search results\n';
mermaidDiagram += `ACS->>Index: Search using text\n`;
mermaidDiagram += `ACS->>Index: Search using keywords\n`;
mermaidDiagram += 'destroy Index\n';
mermaidDiagram += 'Index-xACS: Text search results\n';
mermaidDiagram += `ACS->>ACS: Merge (rerank) vector and text search results\n`;
mermaidDiagram += 'Index-xACS: Keyword search results\n';
mermaidDiagram += `ACS->>ACS: Merge (rerank) vector and keyword search results\n`;
}
if (queryType == '@QueryType.TextSemantic' || queryType == '@QueryType.HybridSemantic') {
Expand Down Expand Up @@ -207,7 +207,7 @@
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.Engine)" id="searchRequest-Engine-AzureCognitiveSearch" value="@EngineType.AzureCognitiveSearch" v-model="searchRequest.engine">
<label class="form-check-label" for="searchRequest-Engine-AzureCognitiveSearch">Azure Cognitive Search</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Search through content with <a href='https://learn.microsoft.com/azure/search/search-what-is-azure-search' target='_blank'>Azure Cognitive Search</a>. You can use <a href='https://learn.microsoft.com/azure/search/search-lucene-query-architecture' target='_blank'>full-text</a> and optionally <a href='https://learn.microsoft.com/azure/search/vector-search-overview' target='_blank'>vector-based</a> queries. The responses <i>always</i> come directly from the source data, rather than being generated by an AI model. You can optionally enable <a href='https://learn.microsoft.com/azure/search/semantic-search-overview' target='_blank'>semantic search</a> which <i>does</i> use AI, not to generate content but to increase the relevancy of the results."><i class="bi bi-info-circle"></i></span>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Search through content with <a href='https://learn.microsoft.com/azure/search/search-what-is-azure-search' target='_blank'>Azure Cognitive Search</a>. You can use <a href='https://learn.microsoft.com/azure/search/search-lucene-query-architecture' target='_blank'>keyword</a> and optionally <a href='https://learn.microsoft.com/azure/search/vector-search-overview' target='_blank'>vector-based</a> queries. The responses <i>always</i> come directly from the source data, rather than being generated by an AI model. You can optionally enable <a href='https://learn.microsoft.com/azure/search/semantic-search-overview' target='_blank'>semantic search</a> which <i>does</i> use AI, not to generate content but to increase the relevancy of the results."><i class="bi bi-info-circle"></i></span>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.Engine)" id="searchRequest-Engine-AzureOpenAI" value="@EngineType.AzureOpenAI" v-model="searchRequest.engine">
Expand Down Expand Up @@ -269,7 +269,7 @@
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.SearchIndex)" id="searchRequest-SearchIndex-Documents" value="@SearchIndexType.Documents" v-model="searchRequest.searchIndex">
<label class="form-check-label" for="searchRequest-SearchIndex-Documents">Documents</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Contains the full text content of the source data, as <a href='https://learn.microsoft.com/azure/search/search-blob-storage-integration' target='_blank'>extracted from your files in Blob storage</a>. Each file and its entire contents are stored as a single document in the search index, which can therefore be quite large. For regular text or semantic search that works great, but large content may cause issues with token limits, prompt size and content relevancy in AI applications."><i class="bi bi-info-circle"></i></span>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Contains the full text content of the source data, as <a href='https://learn.microsoft.com/azure/search/search-blob-storage-integration' target='_blank'>extracted from your files in Blob storage</a>. Each file and its entire contents are stored as a single document in the search index, which can therefore be quite large. For regular keyword or semantic search that works great, but large content may cause issues with token limits, prompt size and content relevancy in AI applications."><i class="bi bi-info-circle"></i></span>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.SearchIndex)" id="searchRequest-SearchIndex-Chunks" value="@SearchIndexType.Chunks" v-model="searchRequest.searchIndex">
Expand All @@ -284,12 +284,12 @@
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.QueryType)" id="searchRequest-QueryType-TextStandard" value="@QueryType.TextStandard" v-model="searchRequest.queryType">
<label class="form-check-label" for="searchRequest-QueryType-TextStandard">Standard text</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Use regular <a href='https://learn.microsoft.com/azure/search/search-lucene-query-architecture' target='_blank'>full-text search</a>."><i class="bi bi-info-circle"></i></span>
<label class="form-check-label" for="searchRequest-QueryType-TextStandard">Standard keyword</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Use regular <a href='https://learn.microsoft.com/azure/search/search-lucene-query-architecture' target='_blank'>keyword search</a>."><i class="bi bi-info-circle"></i></span>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.QueryType)" id="searchRequest-QueryType-TextSemantic" value="@QueryType.TextSemantic" v-model="searchRequest.queryType">
<label class="form-check-label" for="searchRequest-QueryType-TextSemantic">Semantic text</label>
<label class="form-check-label" for="searchRequest-QueryType-TextSemantic">Semantic keyword</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Use <a href='https://learn.microsoft.com/azure/search/semantic-search-overview' target='_blank'>semantic search</a>, which returns more relevant results by applying language understanding to initial search results. It can also return <a href='https://learn.microsoft.com/azure/search/semantic-how-to-query-request' target='_blank'>semantic captions</a> (parts of a document that best summarize the content) and even <a href='https://learn.microsoft.com/azure/search/semantic-answers' target='_blank'>semantic answers</a> (direct answers to queries that look like a question). In all cases, the responses aren't AI-generated but come directly from the source data."><i class="bi bi-info-circle"></i></span>
</div>
<div class="form-check form-check-inline">
Expand All @@ -299,12 +299,12 @@
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.QueryType)" id="searchRequest-QueryType-HybridStandard" value="@QueryType.HybridStandard" v-model="searchRequest.queryType" v-bind:disabled="searchRequest.searchIndex == '@SearchIndexType.Documents'">
<label class="form-check-label" for="searchRequest-QueryType-HybridStandard">Standard hybrid (text + vector)</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Combine the results of a <a href='https://learn.microsoft.com/azure/search/vector-search-overview' target='_blank'>vector search</a> with the regular <a href='https://learn.microsoft.com/azure/search/search-lucene-query-architecture' target='_blank'>full-text search</a> results into a single ranked response."><i class="bi bi-info-circle"></i></span>
<label class="form-check-label" for="searchRequest-QueryType-HybridStandard">Standard hybrid (keyword + vector)</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Combine the results of a <a href='https://learn.microsoft.com/azure/search/vector-search-overview' target='_blank'>vector search</a> with the regular <a href='https://learn.microsoft.com/azure/search/search-lucene-query-architecture' target='_blank'>keyword search</a> results into a single ranked response."><i class="bi bi-info-circle"></i></span>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="@nameof(SearchRequest.QueryType)" id="searchRequest-QueryType-HybridSemantic" value="@QueryType.HybridSemantic" v-model="searchRequest.queryType" v-bind:disabled="searchRequest.searchIndex == '@SearchIndexType.Documents'">
<label class="form-check-label" for="searchRequest-QueryType-HybridSemantic">Semantic hybrid (text + vector)</label>
<label class="form-check-label" for="searchRequest-QueryType-HybridSemantic">Semantic hybrid (keyword + vector)</label>
<span class="info-tip" data-bs-toggle="popover" data-bs-content="Combine the results of a <a href='https://learn.microsoft.com/azure/search/vector-search-overview' target='_blank'>vector search</a> with <a href='https://learn.microsoft.com/azure/search/semantic-search-overview' target='_blank'>semantic search</a> results into a single ranked response. Compared to standard hybrid search, this provides even more accuracy with L2 reranking using the same language models that power Bing."><i class="bi bi-info-circle"></i></span>
</div>
</div>
Expand Down
Loading

0 comments on commit 17b9940

Please sign in to comment.