-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifying feed service to use Lucene search
- Loading branch information
Showing
9 changed files
with
164 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
|
||
namespace NuGetGallery | ||
{ | ||
public class CountInterceptor : ExpressionVisitor | ||
{ | ||
private readonly long count; | ||
public CountInterceptor(long count) | ||
{ | ||
this.count = count; | ||
} | ||
|
||
protected override Expression VisitMethodCall(MethodCallExpression node) | ||
{ | ||
var method = node.Method; | ||
if ((method.DeclaringType == typeof(Queryable)) && method.Name.Equals("LongCount", StringComparison.Ordinal)) | ||
{ | ||
return Expression.Constant(count); | ||
} | ||
|
||
return base.VisitMethodCall(node); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
|
||
namespace NuGetGallery | ||
{ | ||
public class DisregardODataInterceptor : ExpressionVisitor | ||
{ | ||
protected override Expression VisitMethodCall(MethodCallExpression node) | ||
{ | ||
var methodsToIgnore = new HashSet<string>(new[] { "Take", "Skip", "OrderBy", "ThenBy" }, StringComparer.Ordinal); | ||
var method = node.Method; | ||
if ((method.DeclaringType == typeof(Queryable)) && methodsToIgnore.Contains(method.Name)) | ||
{ | ||
// The expression is of the format Queryable.OrderBy(<Expression>, <Order-by-params>). To avoid performing the | ||
// method, we ignore it, traversing the passed in expression instead. | ||
return Visit(node.Arguments[0]); | ||
} | ||
return base.VisitMethodCall(node); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters