0

Our index looks like (this is from the query explorer) :

  "value": [
        {
            "@search.score": 1.5390168,
            "key": "xxx",
            "content": null,
            "fileSize": null,
            "filenames": [
                "File 1.docx",
                "File 1.docx",
                "File 1.docx",
            ],
            "paths": [
                "\\\\Server\\Share\FolderA",
                "\\\\Server\\Share\FolderB",
                "\\\\Server\\Share\FolderC",
            ]
        },

This showing that File 1.doc exists in more than once place, but we store it once in azure blob storange and thats why we have one key, the xxx is the blob storage key.

I have been reading the docs OData Expression Syntax for Azure Search but I don't see an example that allows us to filter with a startswith or contains from the collection.

I have tried

var searchParameters = new SearchParameters()
{
    Filter = @"paths/any(t: t gt '\\Server\Share')", 
};

We need to be able to search for the contents of a file for a given path.

EDIT

Our CosmosDb database has the view of the data as it's represented to the user, this database has links to the blob, so the other option would be to index the CosmosDb and have the indexer follow the links to the blobs, the documentation does not suggest that this is possible. Or, would we be better to write our own indexer and host this as an azure function.

We have one row per document and a pointer to the blob, many document rows can point to the same blob.

Steve Drake
  • 1,968
  • 2
  • 19
  • 41
  • Well, *if* it works, the OData syntax would be `paths/any(t: startswith(t, '\\Server\Share'))`. – juunas Jan 09 '18 at 16:47
  • Hmm, seems like you can't use arbitrary functions in lambdas with Search. You can check the docs for more info: https://learn.microsoft.com/en-us/rest/api/searchservice/OData-Expression-Syntax-for-Azure-Search – juunas Jan 09 '18 at 16:54
  • aye, I tried that :) I am reading the docs right now :) ... again :) I don't think its supported. – Steve Drake Jan 09 '18 at 17:01

1 Answers1

1

I have solved this with

var searchParameters = new SearchParameters()
{
    Filter = @"search.ismatch('""\\\\server\\share\\path""','paths','simple','all')",
};

I will do some more testing and update this answer if needed

Steve Drake
  • 1,968
  • 2
  • 19
  • 41
  • Using search.ismatch is the right thing to do if you want to filter using a partial term. Regular filter expressions need to match the query terms exactly. You can learn more how to customize how the indexed or query terms are processed from this article: https://learn.microsoft.com/en-us/azure/search/search-lucene-query-architecture. – Yahnoosh Jan 10 '18 at 02:39