Permalink
Browse files

Merge branch 'master' of https://github.com/synhershko/ravendb

  • Loading branch information...
2 parents 8d09ed9 + ea5dc2f commit e6f8dc2c566e49128be683e9dbace09b41c75ac3 @ayende ayende committed Oct 27, 2011
@@ -34,24 +34,26 @@ protected override void Initialize()
public override bool Authorize(IHttpContext ctx)
{
- var requestUrl = ctx.GetRequestUrl();
-
- if (neverSecretUrls.Contains(requestUrl, StringComparer.InvariantCultureIgnoreCase))
- return true;
-
-
if (server.DefaultConfiguration.AnonymousUserAccessMode == AnonymousUserAccessMode.None && IsInvalidUser(ctx))
{
+ var requestUrl = ctx.GetRequestUrl();
+ if (neverSecretUrls.Contains(requestUrl, StringComparer.InvariantCultureIgnoreCase))
+ return true;
+
ctx.SetStatusToUnauthorized();
return false;
}
- IHttpRequest httpRequest = ctx.Request;
+ var httpRequest = ctx.Request;
if (server.DefaultConfiguration.AnonymousUserAccessMode == AnonymousUserAccessMode.Get &&
IsInvalidUser(ctx) &&
IsGetRequest(httpRequest.HttpMethod, httpRequest.Url.AbsolutePath) == false)
{
+ var requestUrl = ctx.GetRequestUrl();
+ if (neverSecretUrls.Contains(requestUrl, StringComparer.InvariantCultureIgnoreCase))
+ return true;
+
ctx.SetStatusToUnauthorized();
return false;
}
@@ -0,0 +1,54 @@
+using System.Linq;
+using Raven.Abstractions.Indexing;
+using Raven.Client.Indexes;
+using Xunit;
+
+namespace Raven.Tests.Querying
+{
+ public class SearchOperator : LocalClientTest
+ {
+ public class Something
+ {
+ public int Id { get; set; }
+ public string MyProp { get; set; }
+ }
+
+ public class FTSIndex : AbstractIndexCreationTask<Something>
+ {
+ public FTSIndex()
+ {
+ Map = docs => from doc in docs
+ select new {doc.MyProp};
+
+ Indexes.Add(x => x.MyProp, FieldIndexing.Analyzed);
+ }
+ }
+
+ [Fact]
+ public void DynamicLuceneQuery()
+ {
+ using (var store = NewDocumentStore())
+ {
+ new FTSIndex().Execute(store);
+
+ using (var session = store.OpenSession())
+ {
+ // insert two test documents
+ session.Store(new Something {Id = 23, MyProp = "the first string contains misspelled word sofware"});
+ session.Store(new Something {Id = 34, MyProp = "the second string contains the word software"});
+ session.SaveChanges();
+
+ // search for the keyword software
+ var results = session.Advanced.LuceneQuery<Something>("FTSIndex").Search("MyProp", "software")
+ .WaitForNonStaleResultsAsOfLastWrite()
+ .ToList();
+ Assert.Equal(1, results.Count);
+
+ results = session.Advanced.LuceneQuery<Something>("FTSIndex").Search("MyProp", "software~")
+ .WaitForNonStaleResultsAsOfLastWrite().ToList();
+ Assert.Equal(2, results.Count);
+ }
+ }
+ }
+ }
+}
@@ -595,6 +595,7 @@
<Compile Include="Patching\MetadataPatching.cs" />
<Compile Include="Queries\ParameterisedDynamicQuery.cs" />
<Compile Include="Querying\IndexedUser.cs" />
+ <Compile Include="Querying\SearchOperator.cs" />
<Compile Include="Querying\UsingDocumentQuery.cs" />
<Compile Include="Querying\UsingDynamicQueryWithLocalServer.cs" />
<Compile Include="Querying\UsingDynamicQueryWithRemoteServer.cs" />

0 comments on commit e6f8dc2

Please sign in to comment.