Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

[Azure Search] Add initial query parsing #482

Merged
merged 18 commits into from
Feb 27, 2019
Merged

[Azure Search] Add initial query parsing #482

merged 18 commits into from
Feb 27, 2019

Conversation

loic-sharma
Copy link
Contributor

@loic-sharma loic-sharma commented Feb 26, 2019

Parses NuGet queries and generates an Azure Search query. You can find documentation for Azure Search's query syntax here. You can find documentation for NuGet's query syntax here.

This is missing:

This change has been deployed to DEV. You can test this here: https://nuget-dev-usnc-azuresearch-staging.azurewebsites.net/query?q=packageId:Newtonsoft.Json

Addresses NuGet/NuGetGallery#6456

@loic-sharma loic-sharma changed the title [WIP][Azure Search] Add initial query parsing [Azure Search] Add initial query parsing Feb 26, 2019
// See: https://github.com/NuGet/NuGetGallery/issues/6920
// See: https://github.com/NuGet/NuGetGallery/issues/6922
[Theory]
[InlineData(false, "packageId:hello")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only happen if luceneQuery is true right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. I'm unit testing the current behavior, but this will be addressed by the TODO issues that are linked in the comment above.

}

private static void AppendEscapedString(StringBuilder result, string input)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the legacy service's behavior on surrogate pairs? This is kind of a nasty rabbit hole be we should know what the story is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😈 you can punt this till later but they shouldn't like cause an exception or give a backdoor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to separate issue: NuGet/NuGetGallery#6939

{ "tag:a tags:a", "tags:a" },

// Single word query terms are unquoted.
{ @"""a""", "+(a)" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@joelverhagen joelverhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⌚️

/// The type used to generate Azure Search Service queries. Used by <see cref="SearchTextBuilder"/>.
/// Given the query "fieldA:value1 value2":
///
/// * "value1" is a field-scoped value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XML documentation has markup for lists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather avoid verbose XML syntax as we're not generating docs from these comments. Let me know if you feel strongly about this.

@loic-sharma
Copy link
Contributor Author

🔔 All feedback should be addressed

@loic-sharma loic-sharma merged commit 7479ce4 into azuresearch Feb 27, 2019
@loic-sharma loic-sharma deleted the jver-pq branch February 27, 2019 01:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants