Permalink
Browse files

Fixing <Module> step queries support

  • Loading branch information...
1 parent 7fb8cb0 commit 39fefe0df88947a6f51ea052b64c4f2a7c9c5d26 @sebastienros sebastienros committed Jan 3, 2017
Showing with 45 additions and 24 deletions.
  1. +29 −8 Controllers/FeedServiceController.cs
  2. +15 −15 Orchard.Gallery.csproj
  3. +1 −1 Web.config
@@ -96,11 +96,11 @@ IWorkContextAccessor workContextAccessor
}
private string GetExtensionType(string filter) {
- if (filter.Contains("PackageType eq 'Module'")) {
+ if (filter.IndexOf("PackageType eq 'Module'", StringComparison.OrdinalIgnoreCase) != -1) {
return "Module";
}
- if (filter.Contains("PackageType eq 'Theme'")) {
+ if (filter.IndexOf("PackageType eq 'Theme'", StringComparison.OrdinalIgnoreCase) != -1) {
return "Theme";
}
@@ -110,19 +110,36 @@ IWorkContextAccessor workContextAccessor
private string GetPackageId(string filter) {
// tolower(Id) eq 'orchard.module.contrib.googleanalytics'
- var index = filter.IndexOf("tolower(Id) eq ");
+ var index = filter.IndexOf("tolower(Id) eq ", StringComparison.OrdinalIgnoreCase);
if (index != -1) {
return filter.Substring(index + 15).Replace("'", "");
}
+ index = filter.IndexOf("Id eq ", StringComparison.OrdinalIgnoreCase);
+ if (index != -1) {
+ return filter.Substring(index + 6).Replace("'", "");
+ }
+
+ return null;
+ }
+
+ private string GetVersion(string filter)
+ {
+
+ // Version eq '1.2'
+ var index = filter.IndexOf("Version eq ", StringComparison.OrdinalIgnoreCase);
+ if (index != -1) {
+ return filter.Substring(index + 1).Replace("'", "");
+ }
+
return null;
}
private string GetSearchTerms(string filter) {
string q = "";
int end;
- var index = filter.IndexOf("substringof('");
+ var index = filter.IndexOf("substringof('", StringComparison.OrdinalIgnoreCase);
if (index != -1) {
end = filter.IndexOf("'", index + 13);
@@ -145,6 +162,7 @@ IWorkContextAccessor workContextAccessor
var q = GetSearchTerms(filter);
var type = GetExtensionType(filter);
var packageId = GetPackageId(filter);
+ var version = GetVersion(filter);
if (!String.IsNullOrWhiteSpace(q)) {
searchBuilder.Parse(
@@ -154,15 +172,18 @@ IWorkContextAccessor workContextAccessor
);
}
- if (!String.IsNullOrWhiteSpace(type)) {
- searchBuilder.WithField("package-extension-type", type.ToLowerInvariant()).NotAnalyzed().ExactMatch();
- }
-
+
if (!String.IsNullOrEmpty(packageId)) {
+
searchBuilder.WithField("package-id", packageId).ExactMatch();
searchBuilder.Slice(0, 1);
}
+ if (!String.IsNullOrWhiteSpace(type)) {
+ searchBuilder.WithField("package-extension-type", type.ToLowerInvariant()).NotAnalyzed().AsFilter().ExactMatch();
+ }
+
+
// Only apply custom order if there is no search filter. Otherwise some oddly related packages
// might appear at the top.
if (String.IsNullOrWhiteSpace(q) && !String.IsNullOrWhiteSpace(orderby)) {
@@ -13,7 +13,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Gallery</RootNamespace>
<AssemblyName>Orchard.Gallery</AssemblyName>
- <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>false</UseIISExpress>
<FileUpgradeFlags>
@@ -129,20 +129,6 @@
<Content Include="Module.txt" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
- <Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
- <Name>Orchard.Framework</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Core\Orchard.Core.csproj">
- <Project>{9916839c-39fc-4ceb-a5af-89ca7e87119f}</Project>
- <Name>Orchard.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\Orchard.Tags\Orchard.Tags.csproj">
- <Project>{5d0f00f0-26c9-4785-ad61-b85710c60eb0}</Project>
- <Name>Orchard.Tags</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<Content Include="Recipes\Gallery.recipe.xml">
<SubType>Designer</SubType>
</Content>
@@ -184,6 +170,20 @@
<ItemGroup>
<Content Include="Views\Parts.PackageVersion.Fields.SummaryAdmin.cshtml" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
+ <Project>{2d1d92bb-4555-4cbe-8d0e-63563d6ce4c6}</Project>
+ <Name>Orchard.Framework</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Core\Orchard.Core.csproj">
+ <Project>{9916839c-39fc-4ceb-a5af-89ca7e87119f}</Project>
+ <Name>Orchard.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Orchard.Tags\Orchard.Tags.csproj">
+ <Project>{5d0f00f0-26c9-4785-ad61-b85710c60eb0}</Project>
+ <Name>Orchard.Tags</Name>
+ </ProjectReference>
+ </ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
View
@@ -24,7 +24,7 @@
</pages>
</system.web.webPages.razor>
<system.web>
- <compilation targetFramework="4.5.1">
+ <compilation targetFramework="4.5.2">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

0 comments on commit 39fefe0

Please sign in to comment.