### Main Method - Running Examples
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.DistanceFacetsExample.html
The entry point for the example. It runs the search and drill-down examples and prints the results to the console.
```csharp
public static void Main(string[] args)
{
// ... implementation details ...
}
```
--------------------------------
### SetUp() Method for Instance Setup
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
A virtual method for subclasses to override for instance-level setup. Overrides must call the base class's SetUp() method.
```csharp
[SetUp]
public virtual void SetUp()
```
--------------------------------
### Instance-Level Setup with SetUpAttribute
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Use SetUpAttribute for instance-level setup that runs before each test method.
```csharp
NUnit.Framework.SetUpAttribute
```
--------------------------------
### Configuration Examples
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Examples of how to configure test settings using different methods.
```APIDOC
## Configuration Examples
### _.runsettings_ File Configuration Example
```xml
```
See the _.runsettings_ documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
### Attribute Configuration Example
```csharp
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]
```
### _lucene.testsettings.json_ File Configuration Example
Add a file named _lucene.testsettings.json_ to the executable directory or any directory between the executable and the root of the drive with the following contents.
```json
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}
```
### Environment Variable Configuration Example
| Variable | Value |
|-----------------------|--------------------|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
```
--------------------------------
### Setup()
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.ReadTask.html
Performs setup work for the task that should not be measured as part of the task's execution time. Subclasses can override this to move setup operations out of the main `DoLogic` method.
```APIDOC
## Setup()
### Description
Task setup work that should not be measured for that specific task. By default it does nothing, but tasks can implement this, moving work from DoLogic() to this method. Only the work done in DoLogic() is measured for this task. Notice that higher level (sequence) tasks containing this task would then measure larger time than the sum of their contained tasks.
### Method
`public override void Setup()`
### Overrides
PerfTask.Setup()
### Remarks
Note: All ReadTasks reuse the reader if it is already open. Otherwise a reader is opened at start and closed at the end.
The `search.num.hits` config parameter sets the top number of hits to collect during searching. If `print.hits.field` is set, then each hit is printed along with the value of that field.
Other side effects: none.
```
--------------------------------
### Setup Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.ReadTokensTask.html
Documentation for the Setup method of the ReadTokensTask class.
```APIDOC
## Setup Method
Task setup work that should not be measured for that specific task. By default it does nothing, but tasks can implement this, moving work from DoLogic() to this method. Only the work done in DoLogic() is measured for this task. Notice that higher level (sequence) tasks containing this task would then measure larger time than the sum of their contained tasks.
### Declaration
```csharp
public override void Setup()
```
### Overrides
PerfTask.Setup()
```
--------------------------------
### Setup() Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.SearchTravRetVectorHighlightTask.html
The Setup() method is part of the task setup work that should not be measured for the specific task. Tasks can implement this to move work from DoLogic() to this method, ensuring only DoLogic() is measured.
```APIDOC
## Setup() Method
### Description
Performs setup work for a task that should not be included in the task's measured execution time. This allows for pre-computation or resource allocation before the main logic of the task begins.
### Method
```public override void Setup()```
### Endpoint
Not applicable.
### Parameters
None.
### Request Body
None.
### Response
None.
### Remarks
This method is intended to be overridden by specific tasks. By default, it does nothing. Higher-level tasks that contain tasks implementing `Setup()` will measure a larger time than the sum of their contained tasks if setup work is performed.
### Overrides
- `ReadTask.Setup()`
```
--------------------------------
### Setup()
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.SearchTravRetHighlightTask.html
Performs setup work for the task that should not be measured. This allows for pre-computation or initialization before the main logic is executed.
```APIDOC
## ReadTask.Setup()
### Description
Performs task setup work that should not be measured. This method can be overridden to move work from `DoLogic()` to `Setup()`, ensuring only the `DoLogic()` execution time is measured for the task.
### Method
Setup
### Remarks
By default, this method does nothing. Tasks can implement this method to perform initialization or pre-computation. Higher-level tasks containing this task will measure a larger time if work is moved to `Setup()` compared to the sum of their contained tasks' measured times.
Uses the Lucene.Net.Search.Highlight.SimpleHTMLFormatter for formatting. This task reuses the reader if it is already open; otherwise, a reader is opened at the start and closed at the end. It accepts optional multivalued, comma-separated parameters for controlling traversal size, highlighting, fragment count, merging, and specific fields.
**Parameters String Format:**
```
size[],highlight[],maxFrags[],mergeContiguous[],fields[name1;name2;...]
```
**Parameter Details:**
- **traversal size**: The number of hits to traverse. If not specified, all hits are traversed.
- **highlight**: The number of hits to highlight. Must be less than or equal to traversal size. Defaults to MaxValue.
- **maxFrags**: The maximum number of fragments to score by the highlighter.
- **mergeContiguous**: If `true`, contiguous fragments will be merged.
- **fields**: The fields to highlight. If not specified, all fields will be attempted.
**Example:**
```
"SearchHlgtSameRdr" SearchTravRetHighlight(size[10],highlight[10],mergeContiguous[true],maxFrags[3],fields[body]) > : 1000
```
**Additional Notes:**
Documents must be stored in order for this task to work. Term vector positions can also be used. This task increments counters for traversed hits, retrieved documents, and returned fragments.
### Implements
IDisposable
```
--------------------------------
### Run Facet Examples
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.SimpleSortedSetFacetsExample.html
Executes both the facet counting and drill-down examples, printing their respective results to the console. This is the main entry point for the examples.
```csharp
/// Runs the search and drill-down examples and prints the results.
public static void Main(string[] args)
{
Console.WriteLine("Facet counting example:");
Console.WriteLine("-----------------------");
SimpleSortedSetFacetsExample example = new SimpleSortedSetFacetsExample();
IList results = example.RunSearch();
Console.WriteLine("Author: " + results[0]);
Console.WriteLine("Publish Year: " + results[0]);
Console.WriteLine();
Console.WriteLine("Facet drill-down example (Publish Year/2010):");
Console.WriteLine("---------------------------------------------");
Console.WriteLine("Author: " + example.RunDrillDown());
}
}
}
```
--------------------------------
### NUnit Class-Level Setup and Teardown
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute for class-level setup and cleanup. Avoid static initializers for setup.
```csharp
// Example usage (not in source, but implied by description)
// [NUnit.Framework.OneTimeSetUp]
// public static void ClassInitialize()
// {
// // Setup code
// }
// [NUnit.Framework.OneTimeTearDown]
// public static void ClassCleanup()
// {
// // Teardown code
// }
```
--------------------------------
### Example XQuery Usage
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/memory/Lucene.Net.Index.Memory.MemoryIndex.html
Demonstrates an example of using MemoryIndex with XQuery for searching books.
```APIDOC
## Example XQuery Usage
An XQuery that finds all books authored by James that have something to do with "salmon fishing manuals", sorted by relevance.
```xquery
declare namespace lucene = "java:nux.xom.pool.FullTextUtil";
declare variable $query := "+salmon~ +fish* manual~"; (: any arbitrary Lucene query can go here :)
for $book in /books/book[author="James" and lucene:match(abstract, $query) > 0.0]
let $score := lucene:match($book/abstract, $query)
order by $score descending
return $book
```
```
--------------------------------
### Test Setup and Cleanup
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Configuration for class-level and instance-level setup and cleanup methods using NUnit attributes.
```APIDOC
## Test Setup and Cleanup
### Description
This section describes how to configure test setup and cleanup methods using NUnit attributes for both class-level (suite) and instance-level tests.
### Class-Level Setup/Cleanup
Use static methods annotated with `NUnit.Framework.OneTimeSetUpAttribute` for class-level setup and `NUnit.Framework.OneTimeTearDownAttribute` for class-level cleanup. These methods are managed by the test framework.
**Recommendation:** Avoid static initializers (including complex readonly field initializers) as they execute before setup rules and can cause issues.
### Instance-Level Setup/Cleanup
Use methods annotated with `NUnit.Framework.SetUpAttribute` for instance-level setup and `NUnit.Framework.TearDownAttribute` for instance-level cleanup.
**Important:** If overriding `SetUp()` or `TearDown()` in a subclass, ensure you call `base.SetUp()` and `base.TearDown()` respectively.
```
--------------------------------
### NearSpansUnordered Start Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Search.Spans.NearSpansUnordered.html
Gets the start position of the current match. The initial value is invalid.
```csharp
public override int Start { get; }
```
--------------------------------
### Get Start Time in Milliseconds - C#
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.PerfRunData.html
Retrieves the start time of the current operation in milliseconds. This property is read-only.
```csharp
public virtual long StartTimeMillis { get; }
```
--------------------------------
### Class-Level Setup with OneTimeSetUpAttribute
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Use OneTimeSetUpAttribute for suite-level setup that runs once before any tests in the class.
```csharp
NUnit.Framework.OneTimeSetUpAttribute
```
--------------------------------
### Run Benchmark Sample
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/cli/benchmark/sample.html
This example demonstrates how to execute the benchmark sample command. No specific arguments are required to run the default sample performance test.
```bash
lucene benchmark sample
```
--------------------------------
### PositionSpan Start Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/highlighter/Lucene.Net.Search.Highlight.PositionSpan.html
Gets or sets the start position of the span. This API is for internal purposes only and might change in incompatible ways in the next release.
```csharp
public int Start { get; set; }
```
--------------------------------
### START_OF_HEADING_MARKER constant
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Reverse.ReverseStringFilter.html
An example marker character: U+0001 (START OF HEADING).
```csharp
public const char START_OF_HEADING_MARKER = '\u0001'
```
--------------------------------
### UnCompiledNode Depth Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Util.Fst.Builder.UnCompiledNode-1.html
Gets the depth of this node in the FST, starting from the root.
```csharp
public int Depth { get; }
```
--------------------------------
### GrowableWriter Get Method (Bulk)
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Util.Packed.GrowableWriter.html
Bulk get: reads at least one and at most `len` longs starting from `index` into `arr[off:off+len]` and returns the actual number of values that have been read.
```csharp
public override int Get(int index, long[] arr, int off, int len)
```
--------------------------------
### Configuration Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/queryparser/Lucene.Net.QueryParsers.Flexible.Standard.StandardQueryParser.html
Shows how to configure the StandardQueryParser before parsing a query.
```APIDOC
## Configuration Example
```csharp
StandardQueryParser queryParserHelper = new StandardQueryParser();
queryParserHelper.Analyzer = new WhitespaceAnalyzer();
queryParserHelper.AllowLeadingWildcard = true;
// Or alternatively use the query config handler returned by StandardQueryParser which is a
// StandardQueryConfigHandler:
queryParserHelper.QueryConfigHandler.Set(ConfigurationKeys.ALLOW_LEADING_WILDCARD, true);
```
```
--------------------------------
### MappingMultiDocsAndPositionsEnum.StartOffset Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Codecs.MappingMultiDocsAndPositionsEnum.html
Gets the start offset for the current position. Returns -1 if offsets were not indexed.
```csharp
public override int StartOffset { get; }
```
--------------------------------
### Instance-Level Setup with SetUpAttribute
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Use methods annotated with NUnit.Framework.SetUpAttribute for instance-level setup. Remember to call `base.SetUp()` if overriding in a subclass.
```csharp
[NUnit.Framework.SetUp]
```
--------------------------------
### Configure CapitalizationFilterFactory with KEEP
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Miscellaneous.CapitalizationFilterFactory.html
Example of configuring the CapitalizationFilterFactory with the 'keep' parameter to specify words that should not be capitalized. This setup uses WhitespaceTokenizerFactory.
```xml
```
--------------------------------
### BytesRef Offset Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Util.BytesRef.html
Gets or sets the starting position of the valid bytes within the BytesRef's backing array.
```csharp
public int Offset { get; set; }
```
--------------------------------
### Get StartOffset Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Analysis.TokenAttributes.OffsetAttribute.html
Retrieves the starting offset of the token, which is the position of the first character corresponding to the token in the source text.
```csharp
public virtual int StartOffset { get; }
```
--------------------------------
### StartTimeMillis Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.PerfRunData.html
Gets the start time in milliseconds. This property is part of the core Lucene.Net functionality and provides timing information.
```APIDOC
## StartTimeMillis
### Description
Gets start time in milliseconds.
### Method
GET
### Endpoint
/api/properties/StartTimeMillis
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- **StartTimeMillis** (long) - The start time in milliseconds.
#### Response Example
```json
{
"StartTimeMillis": 1678886400000
}
```
```
--------------------------------
### Get a Random CultureInfo
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Returns a random CultureInfo from the cultures installed on the system. This method is useful for testing culture-sensitive operations.
```csharp
public static CultureInfo RandomCulture(Random random)
```
--------------------------------
### Class and Instance Setup/Cleanup
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Details on how to implement setup and cleanup logic for test classes and instances using NUnit attributes.
```APIDOC
### Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. **Try not to use static initializers (including complex readonly field initializers).** Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated methods. If you override either SetUp() or TearDown() in your subclass, make sure you call `base.SetUp()` and `base.TearDown()`. This is detected and enforced.
```
--------------------------------
### Main Method - Facet Examples Runner
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.SimpleFacetsExample.html
The main entry point for the examples. It initializes and runs various facet counting, search, drill-down, and drill-sideways scenarios, printing the results to the console.
```csharp
public static void Main(string[] args)
{
Console.WriteLine("Facet counting example:");
Console.WriteLine("-----------------------");
SimpleFacetsExample example1 = new SimpleFacetsExample();
IList results1 = example1.RunFacetOnly();
Console.WriteLine("Author: " + results1[0]);
Console.WriteLine("Publish Date: " + results1[1]);
Console.WriteLine("Facet counting example (combined facets and search):");
Console.WriteLine("-----------------------");
SimpleFacetsExample example = new SimpleFacetsExample();
IList results = example.RunSearch();
Console.WriteLine("Author: " + results[0]);
Console.WriteLine("Publish Date: " + results[1]);
Console.WriteLine();
Console.WriteLine("Facet drill-down example (Publish Date/2010):");
Console.WriteLine("---------------------------------------------");
Console.WriteLine("Author: " + example.RunDrillDown());
Console.WriteLine();
Console.WriteLine("Facet drill-sideways example (Publish Date/2010):");
Console.WriteLine("---------------------------------------------");
foreach (FacetResult result in example.RunDrillSideways())
{
Console.WriteLine(result);
}
}
```
--------------------------------
### Custom LuceneTestFrameworkInitializer Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.html
Subclass LuceneTestFrameworkInitializer to customize dependency injection. Override Initialize() to set factories and TestFrameworkSetUp() for assembly-level setup.
```csharp
using RandomizedTesting.Generators;
public class Startup : LuceneTestFrameworkInitializer
{
// Run first
protected override void Initialize()
{
// Inject a custom configuration factory
ConfigurationFactory = new MyConfigurationFactory();
// Do any additional dependency injection setup here
}
// Run before all tests in the assembly and before any class-level setup
protected overide void TestFrameworkSetUp()
{
// Get the random instance for the current context
var random = Random;
```
--------------------------------
### Get StartOffset Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Analysis.Token.html
Returns the starting offset of a token in the source text. The difference between EndOffset and StartOffset may not equal termText.Length.
```csharp
public int StartOffset { get; }
```
--------------------------------
### Setup Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.PerfTask.html
Performs setup work for a performance task that should not be measured as part of the task's execution time. This allows for more accurate measurement of the core logic.
```APIDOC
## Setup()
### Description
Task setup work that should not be measured for that specific task.
### Method
`public virtual void Setup()`
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
None
#### Response Example
None
### Remarks
By default it does nothing, but tasks can implement this, moving work from DoLogic() to this method. Only the work done in DoLogic() is measured for this task. Notice that higher level (sequence) tasks containing this task would then measure larger time than the sum of their contained tasks.
Every performance task extends this class, and provides its own DoLogic() method, which performs the actual task. Tasks performing some work that should be measured for the task, can override Setup() and/or TearDown() and place that work there.
Relevant properties:
* task.max.depth.log
Also supports the following logging attributes:
* log.step specifies how often to log messages about the current running task. Default is 1000 DoLogic() invocations. Set to -1 to disable logging.
* log.step.[class Task Name] specifies the same as 'log.step', only for a particular task name. For example, log.step.AddDoc will be applied only for AddDocTask. It's a way to control per task logging settings. If you want to omit logging for any other task, include log.step=-1. The syntax is "log.step." together with the Task's 'short' name (i.e., without the 'Task' part).
```
--------------------------------
### AssociationsFacetsExample.Main Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.AssociationsFacetsExample.html
The main entry point for the AssociationsFacets example. It runs the sum associations example and prints the results to the console.
```csharp
public static void Main(string[] args)
{
Console.WriteLine("Sum associations example:");
Console.WriteLine("-------------------------");
IList results = new AssociationsFacetsExample().RunSumAssociations();
Console.WriteLine("tags: " + results[0]);
Console.WriteLine("genre: " + results[1]);
}
```
--------------------------------
### Get TSTNode by Key (from root)
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/suggest/Lucene.Net.Search.Suggest.Jaspell.JaspellTernarySearchTrie.html
Retrieves the TSTNode corresponding to the given key, starting the search from the root. Returns null if the node is not found.
```csharp
public virtual JaspellTernarySearchTrie.TSTNode GetNode(string key)
```
--------------------------------
### StartElement Convenience Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/TagSoup.XMLWriter.html
Demonstrates the simplified StartElement method, which is more efficient than the standard SAX2 method by avoiding the allocation of new empty attribute lists.
```csharp
w.StartElement("foo");
```
--------------------------------
### Access CharacterBuffer Length Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Util.CharacterUtils.CharacterBuffer.html
Gets the current length of the data stored in the internal buffer, starting from the specified offset. This property is read-only.
```csharp
public int Length { get; }
```
--------------------------------
### SynonymFilter Greedy Parsing Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Synonym.html
Illustrates the greedy parsing behavior of SynonymFilter. When multiple rules apply, the one starting earliest and parsing the most tokens wins. This example shows input 'a b c d e' parsing to 'y b c d' based on the provided rules.
```text
a -> x
a b -> y
b c d -> z
```
--------------------------------
### Class and Instance Setup
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Explains how to use NUnit attributes for setting up and tearing down test fixtures and instances.
```APIDOC
## Class and Instance Setup
### Description
Use static methods annotated with `NUnit.Framework.OneTimeSetUpAttribute` and `NUnit.Framework.OneTimeTearDownAttribute` for suite-level setup and cleanup. Use `NUnit.Framework.SetUpAttribute` and `NUnit.Framework.TearDownAttribute` for instance-level setup and cleanup. Remember to call `base.SetUp()` and `base.TearDown()` if overriding these methods in subclasses.
### Best Practices
Avoid static initializers, including complex readonly field initializers, as they execute before setup rules and can cause issues.
```
--------------------------------
### RangeFacetsExample Class
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.RangeFacetsExample.html
The main class for the range faceting example. It includes setup, indexing, searching, and drill-down functionality. Ensure proper disposal of resources.
```csharp
using Lucene.Net.Analysis.Core;
using Lucene.Net.Documents;
using Lucene.Net.Facet;
using Lucene.Net.Facet.Range;
using Lucene.Net.Index;
using Lucene.Net.Search;
using Lucene.Net.Store;
using Lucene.Net.Util;
using System;
namespace Lucene.Net.Demo.Facet
{
///
/// Shows simple usage of dynamic range faceting.
///
public sealed class RangeFacetsExample : IDisposable
{
///
/// Using a constant for all functionality related to a specific index
/// is the best strategy. This allows you to upgrade Lucene.Net first
/// and plan the upgrade of the index binary format for a later time.
/// Once the index is upgraded, you simply need to update the constant
/// version and redeploy your application.
///
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
private readonly Directory indexDir = new RAMDirectory();
private IndexSearcher searcher;
private readonly long nowSec = DateTime.Now.Ticks;
internal readonly Int64Range PAST_HOUR;
internal readonly Int64Range PAST_SIX_HOURS;
internal readonly Int64Range PAST_DAY;
/// Constructor
public RangeFacetsExample()
{
PAST_HOUR = new Int64Range("Past hour", nowSec - 3600, true, nowSec, true);
PAST_SIX_HOURS = new Int64Range("Past six hours", nowSec - 6 * 3600, true, nowSec, true);
PAST_DAY = new Int64Range("Past day", nowSec - 24 * 3600, true, nowSec, true);
}
/// Build the example index.
public void Index()
{
using IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(EXAMPLE_VERSION,
new WhitespaceAnalyzer(EXAMPLE_VERSION)));
// Add documents with a fake timestamp, 1000 sec before
// "now", 2000 sec before "now", ...:
for (int i = 0; i < 100; i++)
{
Document doc = new Document();
long then = nowSec - i * 1000;
// Add as doc values field, so we can compute range facets:
doc.Add(new NumericDocValuesField("timestamp", then));
// Add as numeric field so we can drill-down:
doc.Add(new Int64Field("timestamp", then, Field.Store.NO));
indexWriter.AddDocument(doc);
}
// Open near-real-time searcher
searcher = new IndexSearcher(DirectoryReader.Open(indexWriter, true));
}
private static FacetsConfig GetConfig()
{
return new FacetsConfig();
}
/// User runs a query and counts facets.
public FacetResult Search()
{
// Aggregates the facet counts
FacetsCollector fc = new FacetsCollector();
// MatchAllDocsQuery is for "browsing" (counts facets
// for all non-deleted docs in the index); normally
// you'd use a "normal" query:
FacetsCollector.Search(searcher, new MatchAllDocsQuery(), 10, fc);
Facets facets = new Int64RangeFacetCounts("timestamp", fc,
PAST_HOUR,
PAST_SIX_HOURS,
PAST_DAY);
return facets.GetTopChildren(10, "timestamp");
}
/// User drills down on the specified range.
public TopDocs DrillDown(Int64Range range)
{
// Passing no baseQuery means we drill down on all
// documents ("browse only"):
DrillDownQuery q = new DrillDownQuery(GetConfig());
q.Add("timestamp", NumericRangeQuery.NewInt64Range("timestamp", range.Min, range.Max, range.MinInclusive, range.MaxInclusive));
return searcher.Search(q, 10);
}
public void Dispose()
{
searcher?.IndexReader?.Dispose();
indexDir?.Dispose();
}
/// Runs the search and drill-down examples and prints the results.
public static void Main(string[] args)
{
using RangeFacetsExample example = new RangeFacetsExample();
example.Index();
Console.WriteLine("Facet counting example:");
Console.WriteLine("-----------------------");
Console.WriteLine(example.Search());
Console.WriteLine("\n");
Console.WriteLine("Facet drill-down example (timestamp/Past six hours):");
Console.WriteLine("---------------------------------------------");
TopDocs hits = example.DrillDown(example.PAST_SIX_HOURS);
Console.WriteLine(hits.TotalHits + " TotalHits");
}
}
}
```
--------------------------------
### Start Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/spatial/Lucene.Net.Spatial.Prefix.VisitorTemplate.html
Initializes the search process.
```APIDOC
## Start Method
### Description
Called first to setup things.
### Method
protected abstract void
### Exceptions
#### IOException
- Thrown if an I/O error occurs.
```
--------------------------------
### FieldTermStack Generation Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/highlighter/Lucene.Net.Search.VectorHighlight.html
Shows the FieldTermStack generated from term vector data, containing terms from the user query with their start offset, end offset, and position.
```text
FieldTermStack
+------------------+
|"Lucene"(0,6,0) |
+------------------+
|"search"(12,18,3) |
+------------------+
|"library"(26,33,5)|
+------------------+
where : "termText"(startOffset,endOffset,position)
```
--------------------------------
### IndexWriterConfig Initialization Examples
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Index.IndexWriterConfig.html
Examples demonstrating how to initialize IndexWriterConfig using C# property setters and extension methods.
```APIDOC
### Initialization Examples
**Using C# Property Setters:**
```csharp
IndexWriterConfig conf = new IndexWriterConfig(analyzer)
{
Codec = Lucene46Codec(),
OpenMode = OpenMode.CREATE
};
```
**Using Extension Methods (Lucene.Net.Index.Extensions):**
```csharp
using Lucene.Net.Index.Extensions;
IndexWriterConfig conf = new IndexWriterConfig(analyzer)
.SetCodec(new Lucene46Codec())
.SetOpenMode(OpenMode.CREATE);
```
```
--------------------------------
### MaxNumTokensParsed Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/queries/Lucene.Net.Queries.Mlt.MoreLikeThis.html
Gets or Sets the maximum number of tokens to parse in each example doc field that is not stored with TermVector support. This is used for optimization when term vectors are not available.
```csharp
public int MaxNumTokensParsed { get; set; }
```
--------------------------------
### Main Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.RangeFacetsExample.html
Runs the search and drill-down examples and prints the results.
```APIDOC
## Main(string[])
### Description
Runs the search and drill-down examples and prints the results.
### Method
static void Main(string[] args)
### Endpoint
N/A
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
None
```
--------------------------------
### Run multi-category-lists-facets Demo
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/cli/demo/multi-category-lists-facets.html
Execute the multi-category-lists-facets demo. Use options to view or output the source code.
```bash
lucene demo multi-category-lists-facets [-src|--view-source-code] [-out|--output-source-code] [?|-h|--help]
```
```bash
lucene demo multi-category-lists-facets
```
--------------------------------
### Get Preceding Boundary Position - C#
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-opennlp/Lucene.Net.Analysis.OpenNlp.OpenNLPSentenceBreakIterator.html
Sets the iterator's position to the last boundary before the specified position. Returns ICU4N.Text.BreakIterator.Done if the specified position is the starting position.
```csharp
public override int Preceding(int pos)
```
--------------------------------
### Configure Greek Text Analysis in Solr
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.El.GreekStemFilterFactory.html
Example of configuring a Solr field type to use Greek stemming. This setup includes standard tokenization, lowercasing, and Greek stemming.
```xml
```
--------------------------------
### Index Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.RangeFacetsExample.html
Builds the example index.
```APIDOC
## Index()
### Description
Build the example index.
### Method
void Index()
### Endpoint
N/A
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### Get GroupCount Property Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/grouping/Lucene.Net.Search.Grouping.IAbstractAllGroupsCollector-1.html
Demonstrates how to retrieve the total number of groups for an executed search using the GroupCount property. This is a convenience method equivalent to calling GetGroups().Count.
```csharp
GetGroups().Count
```
--------------------------------
### Main Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.AssociationsFacetsExample.html
Runs the sum int/float associations examples and prints the results to the console.
```APIDOC
## Main(string[])
### Description
Runs the sum int/float associations examples and prints the results.
### Method
`public static void Main(string[] args)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
N/A (Console Application Entry Point)
### Response
#### Success Response (200)
N/A (Console Output)
#### Response Example
```
Sum associations example:
-------------------------
tags: ...
genre: ...
```
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
N/A (Console Application Entry Point)
### Response
#### Success Response (200)
N/A (Console Output)
#### Response Example
```
Sum associations example:
-------------------------
tags: ...
genre: ...
```
```
--------------------------------
### Get TSTNode by Key (from specific node)
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/suggest/Lucene.Net.Search.Suggest.Jaspell.JaspellTernarySearchTrie.html
Retrieves the TSTNode corresponding to the given key, starting the search from a specified TSTNode. Returns null if the node is not found. This is a protected method.
```csharp
protected virtual JaspellTernarySearchTrie.TSTNode GetNode(string key, JaspellTernarySearchTrie.TSTNode startNode)
```
--------------------------------
### Index Documents
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.DistanceFacetsExample.html
Builds the example index. This method should be called before performing any searches.
```csharp
public void Index()
{
// ... implementation details ...
}
```
--------------------------------
### FieldQueryNode ToString() Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/queryparser/Lucene.Net.QueryParsers.Flexible.Standard.Nodes.PrefixWildcardQueryNode.html
This method returns a pseudo-XML string representation of the FieldQueryNode, including its start and end positions, field name, and text content. It is useful for debugging and serialization.
```csharp
public override string ToString()
{
return "";
}
```
--------------------------------
### Start Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/highlighter/Lucene.Net.Search.Highlight.IFragmenter.html
Initializes the fragmenter with the original text and the TokenStream. Allows capturing necessary attributes for fragment detection.
```csharp
void Start(string originalText, TokenStream tokenStream)
```
--------------------------------
### Main Method for Example Execution
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.DistanceFacetsExample.html
The entry point for the application. It creates an instance of DistanceFacetsExample and calls its methods to demonstrate search and drill-down functionality.
```csharp
/// Runs the search and drill-down examples and prints the results.
public static void Main(string[] args)
{
using DistanceFacetsExample example = new DistanceFacetsExample();
```
--------------------------------
### FileBasedQueryMaker Configuration Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Feeds.FileBasedQueryMaker.html
Configure the file path for queries and the default field name. The file can contain queries, one per line, with lines starting with '#' treated as comments.
```properties
file.query.maker.file=c:/myqueries.txt
file.query.maker.default.field=body
```
--------------------------------
### Get String Length - Ternary Search Tree
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Compound.Hyphenation.TernaryTree.html
Calculates the length of a string represented by a character array starting from a specified index. This is a utility function for the Ternary Search Tree.
```java
public static int StrLen(char[] a, int start)
```
--------------------------------
### Class and Instance Setup Methods
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Use NUnit attributes like OneTimeSetUpAttribute, OneTimeTearDownAttribute, SetUpAttribute, and TearDownAttribute for managing test suite and instance-level setup and cleanup. Remember to call base methods when overriding SetUp() or TearDown() in subclasses.
```csharp
public static void OneTimeSetUp()
public static void OneTimeTearDown()
public void SetUp()
public void TearDown()
public void base.SetUp()
public void base.TearDown()
```
--------------------------------
### Run Lock Stress Test Client Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/cli/lock/stress-test.html
Example of running the stress test client. This connects to a verify-server and performs lock operations. Adjust parameters based on your test environment.
```bash
lucene lock stress-test 3 127.0.0.4 54464 NativeFSLockFactory F:\temp 50 10
```
--------------------------------
### Define Text Field with German Stemming in Solr
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.De.GermanStemFilterFactory.html
Example of configuring a Solr text field to use German stemming. This setup includes standard tokenization, lowercasing, and German stemming.
```xml
```
--------------------------------
### Get Approximate RAM Bytes Used
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Codecs.BlockTreeTermsReader-1.FieldReader.html
Call this method to determine the approximate amount of RAM in bytes currently being used by the object. No setup or imports are required beyond having an instance of the object.
```csharp
public long RamBytesUsed()
```
--------------------------------
### ICUPostingsHighlighter Example Usage
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/icu/Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.html
Example demonstrating how to configure a field for highlighting and retrieve highlighted snippets at query time.
```APIDOC
## Example Usage
### Description
Demonstrates configuring a field with offsets at index time and retrieving highlights at query time.
### Code Example
```csharp
// configure field with offsets at index time
IndexableFieldType offsetsType = new IndexableFieldType(TextField.TYPE_STORED);
offsetsType.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
Field body = new Field("body", "foobar", offsetsType);
// retrieve highlights at query time
ICUPostingsHighlighter highlighter = new ICUPostingsHighlighter();
Query query = new TermQuery(new Term("body", "highlighting"));
TopDocs topDocs = searcher.Search(query, n);
string[] highlights = highlighter.Highlight("body", query, searcher, topDocs);
```
```
--------------------------------
### Index Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/demo/Lucene.Net.Demo.Facet.RangeFacetsExample.html
Builds the example index. This method is responsible for creating the necessary index structure for the examples.
```csharp
public void Index()
```
--------------------------------
### PerFieldSimilarityWrapper Class
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Search.Similarities.PerFieldSimilarityWrapper.html
Provides the ability to use a different Similarity for different fields. Subclasses should implement Get(string) to return an appropriate Similarity (for example, using field-specific parameter values) for the field.
```APIDOC
## Class PerFieldSimilarityWrapper
### Description
Provides the ability to use a different Similarity for different fields. Subclasses should implement Get(string) to return an appropriate Similarity (for example, using field-specific parameter values) for the field.
**Note**: This API is experimental and might change in incompatible ways in the next release.
### Inheritance
object
Similarity
PerFieldSimilarityWrapper
### Namespace
Lucene.Net.Search.Similarities
### Assembly
Lucene.Net.dll
### Syntax
```csharp
public abstract class PerFieldSimilarityWrapper : Similarity
```
```
--------------------------------
### Implement Start Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/highlighter/Lucene.Net.Search.Highlight.NullFragmenter.html
Initializes the Fragmenter with the original text and TokenStream. Attributes of interest can be obtained from the tokenStream for use in IsNewFragment().
```csharp
public virtual void Start(string originalText, TokenStream tokenStream)
```
--------------------------------
### Example Usage of PerFieldAnalyzerWrapper
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Miscellaneous.PerFieldAnalyzerWrapper.html
Demonstrates how to instantiate PerFieldAnalyzerWrapper with specific analyzers for 'firstname' and 'lastname' fields, while using a default analyzer for others. This setup is useful when different fields require distinct analysis strategies.
```csharp
IDictionary analyzerPerField = new Dictionary();
analyzerPerField["firstname"] = new KeywordAnalyzer();
analyzerPerField["lastname"] = new KeywordAnalyzer();
PerFieldAnalyzerWrapper aWrapper =
new PerFieldAnalyzerWrapper(new StandardAnalyzer(version), analyzerPerField);
```
--------------------------------
### ShardSearchingTestBase Start Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Search.ShardSearchingTestBase.html
Initializes and starts the distributed search simulation. Allows configuration of the number of nodes, run time, and max searcher age.
```csharp
protected virtual void Start(int numNodes, double runTimeSec, int maxSearcherAgeSeconds)
```
--------------------------------
### Get WithWarm Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.SearchTravTask.html
Returns true if warming should be performed. This task reuses the reader if it is already open; otherwise, a reader is opened at the start and closed at the end. It takes an optional traversal size parameter.
```csharp
public override bool WithWarm { get; }
```
--------------------------------
### Get Method (Character Range)
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/analysis-common/Lucene.Net.Analysis.Util.RollingCharBuffer.html
Retrieves a range of characters starting from a specified position with a given length. This method is part of the core functionality that allows the buffer to act like a growing character array.
```csharp
public char[] Get(int posStart, int length)
```
--------------------------------
### NUnit Instance-Level Setup and Teardown
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Use methods annotated with NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute for instance-level setup and cleanup. Ensure to call base.SetUp() and base.TearDown() if overriding these methods in subclasses.
```csharp
// Example usage (not in source, but implied by description)
// [NUnit.Framework.SetUp]
// public void TestInitialize()
// {
// // Setup code
// base.SetUp();
// }
// [NUnit.Framework.TearDown]
// public void TestCleanup()
// {
// // Teardown code
// base.TearDown();
// }
```
--------------------------------
### Initialize NRTCachingDirectory
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Store.NRTCachingDirectory.html
Example of initializing NRTCachingDirectory with FSDirectory, specifying cache parameters for merge size and total cached bytes. This setup is useful for optimizing NRT search performance by keeping frequently accessed segments in memory.
```csharp
using Directory fsDir = FSDirectory.Open(new DirectoryInfo("/path/to/index"));
using NRTCachingDirectory cachedFSDir = new NRTCachingDirectory(fsDir, 5.0, 60.0);
IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_48, analyzer);
using IndexWriter writer = new IndexWriter(cachedFSDir, conf);
```
--------------------------------
### StandardQueryParser Parse Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/queryparser/Lucene.Net.QueryParsers.Flexible.Standard.StandardQueryParser.html
Demonstrates how to use the StandardQueryParser to parse a query string. Shows basic parsing and how to configure the parser before use.
```csharp
StandardQueryParser queryParserHelper = new StandardQueryParser();
Query query = queryParserHelper.Parse("a AND b", "defaultField");
```
```csharp
queryParserHelper.Analyzer = new WhitespaceAnalyzer();
queryParserHelper.AllowLeadingWildcard = true;
// Or alternativley use the query config handler returned by StandardQueryParser which is a
// StandardQueryConfigHandler:
queryParserHelper.QueryConfigHandler.Set(ConfigurationKeys.ALLOW_LEADING_WILDCARD, true);
```
--------------------------------
### Get Ordinal Field Value
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/queries/Lucene.Net.Queries.Function.ValueSources.html
Obtains the ordinal of a field value using the default Lucene FieldCache. The native index order is used, and values are numbered starting from 1. Be aware that ordinals can change with index modifications.
```csharp
Example:
```
If there were only three field values: "apple","banana","pear"
then ord("apple")=1, ord("banana")=2, ord("pear")=3
```
```
--------------------------------
### Main Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/facet/Lucene.Net.Facet.Taxonomy.PrintTaxonomyStats.html
The entry point for the command-line tool.
```APIDOC
## Main(string[])
Command-line tool.
### Method
```csharp
public static int Main(string[] args)
```
### Parameters
#### Path Parameters
- **args** (string[]) - Description:
```
--------------------------------
### TREC Topics Format Example
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.Quality.Trec.TrecTopicsReader.html
Illustrates the expected format for TREC topics files. Each topic should be enclosed in tags and include , , , and sections. Lines starting with '#' are treated as comments and ignored.
```text
Number: nnn
title of the topic
Description:
description of the topic
Narrative:
"story" composed by assessors.
```
--------------------------------
### Example: Index Files
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/cli/demo/index-files.html
This example demonstrates how to index the contents of a source directory and place the Lucene.Net index in a specified directory. The `-u` option is not used, so any existing index will be overwritten.
```bash
lucene demo index-files X:\test-index C:\Users\BGates\Documents
```
--------------------------------
### Setting Rate for Parallel Sequences
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.html
Append ': N : R' after the closing bracket to specify N repetitions with a rate of R operations per second. This example performs 400 AddDoc operations in parallel, starting up to 3 threads per second.
```plaintext
[ AddDoc ] : 400 : 3
```
--------------------------------
### Example Benchmark Configuration
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.html
This configuration defines parameters for a benchmark test, including merge factor, buffered memory, compound index format, analyzer, directory type, and document storage options. Multi-value parameters like merge.factor and max.buffered are iterated by NewRound and added as columns to reports.
```alg
# -------------------------------------------------------- # # Sample: what is the effect of doc size on indexing time? # # There are two parts in this test: # - PopulateShort adds 2N documents of length L # - PopulateLong adds N documents of length 2L # Which one would be faster? # The comparison is done twice. # # -------------------------------------------------------- # ------------------------------------------------------------------------------------- # multi val params are iterated by NewRound's, added to reports, start with column name. merge.factor=mrg:10:20 max.buffered=buf:100:1000 compound=true analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer directory=FSDirectory doc.stored=true doc.tokenized=true doc.term.vector=false doc.add.log.step=500 docs.dir=reuters-out doc.maker=org.apache.lucene.benchmark.byTask.feeds.SimpleDocMaker query.maker=org.apache.lucene.benchmark.byTask.feeds.SimpleQueryMaker # task at this depth or less would print when they start task.max.depth.log=2 log.queries=false # ------------------------------------------------------------------------------------- { { "PopulateShort" CreateIndex { AddDoc(4000) > : 20000 Optimize CloseIndex > ResetSystemErase { "PopulateLong" CreateIndex { AddDoc(8000) > : 10000 Optimize CloseIndex > ResetSystemErase NewRound } : 2 RepSumByName RepSelectByPref Populate
```
--------------------------------
### Get Limit Property
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/facet/Lucene.Net.Facet.Taxonomy.LruDictionary-2.html
Allows changing the dictionary's maximal number of elements. Note that if the dictionary is already larger than Limit, the current implementation does not shrink it. Rather, the map remains in its current size as new elements are added, and will only start shrinking (until settling again on the given Limit) if existing elements are explicitly deleted.
```csharp
public virtual int Limit { get; set; }
```
--------------------------------
### Test Configuration Examples
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/test-framework/Lucene.Net.Util.LuceneTestCase.html
Examples of how to configure test settings such as random seed and culture using different methods.
```APIDOC
## Test Configuration
### _.runsettings_ File Configuration Example
```xml
```
### Attribute Configuration Example
```csharp
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]
```
### _lucene.testsettings.json_ File Configuration Example
Add a file named _lucene.testsettings.json_ to the executable directory or any directory between the executable and the root of the drive with the following contents.
```json
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}
```
### Environment Variable Configuration Example
| Variable | Value |
|-----------------------|------------------|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
```
--------------------------------
### Example AnalyzerFactory Configuration
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/benchmark/Lucene.Net.Benchmarks.ByTask.Tasks.AnalyzerFactoryTask.html
This example demonstrates the parameter format for AnalyzerFactory, including CharFilterFactory, TokenizerFactory, and TokenFilterFactory components. It shows how to specify names, gaps, and factory arguments.
```java
-AnalyzerFactory(name:'strip html, fold to ascii, whitespace tokenize, max 10k tokens',
positionIncrementGap:100,
HTMLStripCharFilter,
MappingCharFilter(mapping:'mapping-FoldToASCII.txt'),
WhitespaceTokenizer(luceneMatchVersion:LUCENE_43),
TokenLimitFilter(maxTokenCount:10000, consumeAllTokens:false))
```
```java
-NewAnalyzer('strip html, fold to ascii, whitespace tokenize, max 10k tokens')
```
--------------------------------
### Get Method
Source: https://lucenenet.apache.org/docs/4.8.0-beta00017/api/core/Lucene.Net.Index.BinaryDocValues.html
Documentation for the Get method of BinaryDocValues.
```APIDOC
## Method Get(int, BytesRef)
### Description
Lookup the value for document.
### Declaration
```csharp
public abstract void Get(int docID, BytesRef result)
```
### Parameters
#### Path Parameters
- **docID** (int) - Required - The document ID.
- **result** (BytesRef) - Required - The BytesRef to store the value in.
```