Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ce72959
Update build.yml
Shazwazza Jul 21, 2023
4d03424
Update docfx-gh-pages.yml
Shazwazza Jul 21, 2023
98d852c
Update searching.md
vivekBoii Oct 27, 2023
403bfa7
Merge pull request #354 from vivekBoii/release/3.0
Shazwazza Oct 27, 2023
8765159
Update searching.md
vivekBoii Oct 27, 2023
11ef198
Merge pull request #355 from vivekBoii/boii
Shazwazza Oct 27, 2023
10fbef3
Fixes #335
Shazwazza Nov 30, 2023
03d208b
don't allocate if not needed
Shazwazza Nov 30, 2023
f82ae8c
Fix docs for synchronous index building
jakoss Dec 18, 2023
c5a0403
Update indexing.md
jakoss Dec 18, 2023
5004b13
Merge pull request #371 from jakoss/feature/fix-sync-import-docs
Shazwazza Dec 18, 2023
a72e67c
commit ignored test
Shazwazza Dec 20, 2023
56c8971
Adds Id query
Shazwazza Dec 21, 2023
a4ef706
Bump nokogiri from 1.15.4 to 1.16.3 in /docs
dependabot[bot] Mar 19, 2024
7eb3c0d
Merge pull request #380 from Shazwazza/dependabot/bundler/docs/nokogi…
Shazwazza Apr 4, 2024
c8c9579
Bumps to LTS versions of .NET and dependencies. Uses FSDirectory.Open…
Shazwazza May 2, 2024
d36618b
Bump nokogiri from 1.16.3 to 1.16.5 in /docs
dependabot[bot] May 13, 2024
7b81af0
Bump rexml from 3.2.5 to 3.2.8 in /docs
dependabot[bot] May 16, 2024
7899063
Fixes #351
Shazwazza Jun 14, 2024
a367eab
Fixing SyncedFileSystemDirectoryFactory when the main index is corrup…
Shazwazza Jun 26, 2024
c15b7c8
Adds more checks and logging
Shazwazza Jun 26, 2024
41c2221
Adds test
Shazwazza Jun 26, 2024
2a3bcd2
Adds test case
Shazwazza Jun 26, 2024
162c468
missed file
Shazwazza Jun 26, 2024
190b08e
Another test case
Shazwazza Jun 26, 2024
e1a12d0
Merge pull request #384 from Shazwazza/dependabot/bundler/docs/nokogi…
Shazwazza Jun 27, 2024
ef1a5d8
Merge pull request #385 from Shazwazza/dependabot/bundler/docs/rexml-…
Shazwazza Jun 27, 2024
75f5a70
Adds functionality to sync from local to main if main is corrupt with…
Shazwazza Jun 27, 2024
3cb55ea
Makes it optional whether to attempt to fix the indexes, default is f…
Shazwazza Jun 27, 2024
f1857c6
mostly just analysis changes
Shazwazza Jul 17, 2024
d85b1e1
update test output
Shazwazza Jul 18, 2024
5a5c5f2
trying to get tests to work
Shazwazza Jul 18, 2024
7c17e5d
adds logging
Shazwazza Jul 18, 2024
328dcd8
try again
Shazwazza Jul 19, 2024
5fb1fd1
try again
Shazwazza Jul 19, 2024
5129af2
try again
Shazwazza Jul 19, 2024
7c25530
Fix tests
Shazwazza Jul 31, 2024
6332d84
Merge branch 'release/3.0' of https://github.com/Shazwazza/Examine in…
Shazwazza Jul 31, 2024
9727b62
adds notes
Shazwazza Jul 31, 2024
92b514b
Adds Concurrency search tests
Shazwazza Aug 15, 2024
aa098e1
Updates ConcurrencyTests
Shazwazza Aug 15, 2024
52da13e
Adds benchmarks
Shazwazza Aug 16, 2024
b25fa83
adds results
Shazwazza Aug 16, 2024
00cb2a4
Updates various places to reduce the need to acquire a searcher/reade…
Shazwazza Aug 20, 2024
45849a1
Makes lucene simple benchmarks behave more like examine implementation
Shazwazza Aug 20, 2024
3760023
Don't ever use MaxDocs, avoid a query and ensure that max docs used i…
Shazwazza Aug 21, 2024
aaa3d7e
Cleanup, ensure correct disposal, ensure absolute max results
Shazwazza Aug 21, 2024
5090ef1
exclude benchmarks from running in build
Shazwazza Aug 21, 2024
42babc2
try without backslash
Shazwazza Aug 21, 2024
0115e05
try quotes
Shazwazza Aug 21, 2024
6c92de0
brackets?
Shazwazza Aug 21, 2024
ede285e
doh, double dashes
Shazwazza Aug 21, 2024
7728971
Fixes tests, adds notes
Shazwazza Sep 4, 2024
6378213
Ensure we try to refresh when NRT is not enabled.
Shazwazza Sep 4, 2024
64c3d25
oops, make sure we apply all deletes.
Shazwazza Sep 4, 2024
8567da5
don't enable NRT in our synced dir tests
Shazwazza Sep 4, 2024
2283e40
fix build
Shazwazza Sep 4, 2024
e75b43f
Trying to get the build working while ignore running benchmarks.
Shazwazza Sep 4, 2024
9ec6277
try filtering differently?
Shazwazza Sep 4, 2024
47a4240
separate benchmark proj
Shazwazza Sep 4, 2024
24e6405
don't pack
Shazwazza Sep 4, 2024
b2bde05
no assembly info
Shazwazza Sep 4, 2024
f7f8f4c
Fix backward compat
Shazwazza Sep 4, 2024
b566aa3
Updates benchmarks
Shazwazza Sep 10, 2024
6b134b5
fix build
Shazwazza Sep 12, 2024
937b04d
fix build
Shazwazza Sep 12, 2024
c5b761e
fix build
Shazwazza Sep 12, 2024
b78465d
Sorts docs by id for, don't cast, less allocations for better perf. U…
Shazwazza Sep 18, 2024
dc0b886
reverts some last minute changes, ensures multiple searches work when…
Shazwazza Sep 26, 2024
fdcf98e
notes
Shazwazza Sep 26, 2024
3e8bf11
Fixing tests
Shazwazza Sep 30, 2024
7301932
Update build.yml
Shazwazza Oct 1, 2024
f0f5e94
Start adding version comparisons
Shazwazza Oct 10, 2024
5b3b025
Getting nuget comparison benchmarks working
Shazwazza Oct 16, 2024
2f66fe2
fix build
Shazwazza Oct 16, 2024
6719014
fix build
Shazwazza Oct 16, 2024
00dbecc
Ensure benchmarks work between versions (including old buggy ones)
Shazwazza Oct 16, 2024
af8734a
Reduce default max limit
Shazwazza Oct 16, 2024
35ee885
Adds more scenarios for SyncedFileSystemDirectoryFactory and fixes an…
Shazwazza Oct 17, 2024
5fff5b9
ensure commit just in case
Shazwazza Oct 17, 2024
f10f0c5
Merge remote-tracking branch 'origin/master' into hotfix/3.4.0-beta0001
Shazwazza Oct 17, 2024
74f194d
Bump rexml from 3.2.8 to 3.3.9 in /docs
dependabot[bot] Oct 28, 2024
295c45d
Merge pull request #394 from Shazwazza/dependabot/bundler/docs/rexml-…
Shazwazza Nov 21, 2024
efeff6d
merge 3.6.0
Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ on:
- 'master'
- 'dev'
- 'release/*'
- 'hotfix/*'
tags:
- 'v*'
pull_request:
branches:
- 'master'
- 'dev'
- 'release/*'
- 'hotfix/*'

jobs:
build:
Expand All @@ -40,10 +42,9 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
5.0.x
dotnet-version: |
6.0.x
7.0.x
8.0.x

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
Expand All @@ -60,10 +61,10 @@ jobs:
run: dotnet build ${{ env.Solution_File }} --configuration ${{ env.Configuration }} --no-restore

- name: Test
run: dotnet test "${{ env.Test_Proj }}" --no-build --verbosity normal --results-directory ${{ github.workspace }}/_TestResults --logger "trx;logfilename=tests.trx"
run: dotnet test "${{ env.Test_Proj }}" --no-build --verbosity normal --results-directory ${{ github.workspace }}/_TestResults --logger "trx;logfilename=tests.trx" --filter "TestCategory!~Benchmarks"

- name: Upload test results
uses: actions/upload-artifact@v2 # upload test results
uses: actions/upload-artifact@v4 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: examine-test-results
Expand All @@ -85,7 +86,7 @@ jobs:
--output=${{ github.workspace }}/_NugetOutput

- name: Upload artifacts
uses: actions/upload-artifact@v2 # upload nuget
uses: actions/upload-artifact@v4 # upload nuget
if: success()
with:
name: examine-nuget-${{ env.GitVersion_SemVer }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docfx-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
# Runs on pushes targeting the default branch
push:
branches: ["feature/docfx"]
pull_request:
branches:
- 'feature/docfx'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v1.4.2
- uses: dorny/test-reporter@v1
with:
artifact: examine-test-results # artifact name
name: Publish Tests # Name of the check run which will be created
Expand Down
7 changes: 4 additions & 3 deletions docs/articles/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ myIndex.IndexItem(new ValueSet(
Be default all indexing is done asynchronously. If you need to run indexing synchronously you should create a synchronous scope. This is for instance a necessary step for unit tests.

```cs
using (myIndex.ProcessNonAsync())
using (var luceneIndex = (LuceneIndex)myIndex)
using (var syncIndexContext = luceneIndex.WithThreadingMode(IndexThreadingMode.Synchronous))
{
myIndex.IndexItem(new ValueSet(
luceneIndex.IndexItem(new ValueSet(
"SKU987",
"Product",
new Dictionary<string, object>()
Expand Down Expand Up @@ -251,4 +252,4 @@ private void IndexCommited(object sender, EventArgs e)
{
// Triggered when the index is commited
}
```
```
2 changes: 1 addition & 1 deletion docs/articles/searching.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ query.Field("nodeTypeAlias", "CWS_Home".Boost(20));
var results = query.Execute();
```

This will boost the term `CWS_Home` and make enteries with `nodeTypeAlias:CWS_Home` score higher in the results.
This will boost the term `CWS_Home` and make entries with `nodeTypeAlias:CWS_Home` score higher in the results.

## Proximity

Expand Down
4 changes: 2 additions & 2 deletions docs/docs-v1-v2/searching.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ query.Field("nodeTypeAlias", "CWS_Home".Boost(20));
var results = query.Execute();
```

This will boost the term `CWS_Home` and make enteries with `nodeTypeAlias:CWS_Home` score higher in the results.
This will boost the term `CWS_Home` and make entries with `nodeTypeAlias:CWS_Home` score higher in the results.

## Proximity

Expand Down Expand Up @@ -248,4 +248,4 @@ var query = searcher.CreateQuery();
var query = (LuceneSearchQuery)query.NativeQuery("hello:world").And(); // Make query ready for extending
query.LuceneQuery(NumericRangeQuery.NewInt64Range("numTest", 4, 5, true, true)); // Add the raw lucene query
var results = query.Execute();
```
```
8 changes: 6 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
<PropertyGroup>

<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>

<PackageProjectUrl>https://github.com/Shazwazza/Examine</PackageProjectUrl>
<RepositoryUrl>https://github.com/Shazwazza/Examine</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand All @@ -22,7 +25,8 @@
<VersionPrefix>2.0.0</VersionPrefix>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildProjectName)' != 'Examine.Web.Demo' AND '$(MSBuildProjectName)' != 'Examine.Test'">
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<!-- Disable the nullable warnings when compiling for .NET Standard 2.0 -->
Expand Down
147 changes: 147 additions & 0 deletions src/Examine.Benchmarks/ConcurrentAcquireBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Index;
using Lucene.Net.Search;
using Lucene.Net.Store;
using Lucene.Net.Util;
using Microsoft.Extensions.Logging;

namespace Examine.Benchmarks
{
[MediumRunJob(RuntimeMoniker.Net80)]
[ThreadingDiagnoser]
[MemoryDiagnoser]
public class ConcurrentAcquireBenchmarks : ExamineBaseTest
{
private readonly StandardAnalyzer _analyzer = new StandardAnalyzer(LuceneInfo.CurrentVersion);
private string? _tempBasePath;
private FSDirectory? _indexDir;
private IndexWriter? _writer;
private SearcherManager? _searcherManager;

[GlobalSetup]
public override void Setup()
{
base.Setup();

_tempBasePath = Path.Combine(Path.GetTempPath(), "ExamineTests");

// indexer for lucene
var tempIndexer = InitializeAndIndexItems(_tempBasePath, _analyzer, out var indexDir);
tempIndexer.Dispose();
_indexDir = FSDirectory.Open(indexDir);
var writerConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, _analyzer);
//writerConfig.SetMaxBufferedDocs(1000);
//writerConfig.SetReaderTermsIndexDivisor(4);
//writerConfig.SetOpenMode(OpenMode.APPEND);
//writerConfig.SetReaderPooling(true);
//writerConfig.SetCodec(new Lucene46Codec());
_writer = new IndexWriter(_indexDir, writerConfig);
var trackingWriter = new TrackingIndexWriter(_writer);
_searcherManager = new SearcherManager(trackingWriter.IndexWriter, applyAllDeletes: true, new SearcherFactory());
}

[GlobalCleanup]
public override void TearDown()
{
_searcherManager.Dispose();
_writer.Dispose();
_indexDir.Dispose();

base.TearDown();

System.IO.Directory.Delete(_tempBasePath, true);
}

[Params(1, 15, 30, 100)]
public int ThreadCount { get; set; }

[Benchmark(Baseline = true)]
public async Task SimpleMultiThreadLoop()
{
var tasks = new List<Task>();

for (var i = 0; i < ThreadCount; i++)
{
tasks.Add(new Task(() =>
{
var i = 0;
}));
}

foreach (var task in tasks)
{
task.Start();
}

await Task.WhenAll(tasks);
}

[Benchmark]
public async Task TestAcquireThreadContention()
{
var tasks = new List<Task>();

for (var i = 0; i < ThreadCount; i++)
{
tasks.Add(new Task(() =>
{
var searcher = _searcherManager.Acquire();
try
{
if (searcher.IndexReader.RefCount > (ThreadCount + 1))
{
Console.WriteLine(searcher.IndexReader.RefCount);
}
}
finally
{
_searcherManager.Release(searcher);
}
}));
}

foreach (var task in tasks)
{
task.Start();
}

await Task.WhenAll(tasks);
}

#if RELEASE
protected override ILoggerFactory CreateLoggerFactory()
=> Microsoft.Extensions.Logging.LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Information));
#endif
private TestIndex InitializeAndIndexItems(
string tempBasePath,
Analyzer analyzer,
out DirectoryInfo indexDir)
{
var tempPath = Path.Combine(tempBasePath, Guid.NewGuid().ToString());
System.IO.Directory.CreateDirectory(tempPath);
indexDir = new DirectoryInfo(tempPath);
var luceneDirectory = FSDirectory.Open(indexDir);
var indexer = GetTestIndex(luceneDirectory, analyzer);

var random = new Random();
var valueSets = new List<ValueSet>();

for (var i = 0; i < 1000; i++)
{
valueSets.Add(ValueSet.FromObject(Guid.NewGuid().ToString(), "content",
new
{
nodeName = "location " + i,
bodyText = Enumerable.Range(0, random.Next(10, 100)).Select(x => Guid.NewGuid().ToString())
}));
}

indexer.IndexItems(valueSets);

return indexer;
}
}
}
Loading
Loading