lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [06/11] lucenenet git commit: Preliminary conversion of JavaDocs to Markdown
Date Thu, 14 Sep 2017 05:48:27 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Codecs/MockSep/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/MockSep/package.md b/src/Lucene.Net.TestFramework/Codecs/MockSep/package.md
new file mode 100644
index 0000000..caad729
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Codecs/MockSep/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Very simple implementations of [](xref:Lucene.Net.Codecs.Sep) for testing.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Codecs/NestedPulsing/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/NestedPulsing/package.md b/src/Lucene.Net.TestFramework/Codecs/NestedPulsing/package.md
new file mode 100644
index 0000000..b9d4eb5
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Codecs/NestedPulsing/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Codec for testing that wraps [](xref:Lucene.Net.Codecs.Pulsing.PulsingPostingsFormat) with itself.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Codecs/RAMOnly/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/package.md b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/package.md
new file mode 100644
index 0000000..edb7ace
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Codec for testing that never writes to disk.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Codecs/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/package.md b/src/Lucene.Net.TestFramework/Codecs/package.md
new file mode 100644
index 0000000..35bd112
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Codecs/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Codecs for testing (simulate old disk formats, wacky theoretical use cases, etc)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Index/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/package.md b/src/Lucene.Net.TestFramework/Index/package.md
new file mode 100644
index 0000000..2d2255d
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Index/package.md
@@ -0,0 +1,21 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Support for testing of indexes. 
+
+ The primary classes are: * [](xref:Lucene.Net.Index.RandomIndexWriter): Randomizes the indexing experience. [](xref:Lucene.Net.Index.MockRandomMergePolicy): MergePolicy that makes random decisions. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Search/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/package.md b/src/Lucene.Net.TestFramework/Search/package.md
new file mode 100644
index 0000000..4a9f0da
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Search/package.md
@@ -0,0 +1,21 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Support for testing search components. 
+
+ The primary classes are: * [](xref:Lucene.Net.Search.QueryUtils): Useful methods for testing Query classes. [](xref:Lucene.Net.Search.ShardSearchingTestBase): Base class for simulating distributed search. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Store/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/package.md b/src/Lucene.Net.TestFramework/Store/package.md
new file mode 100644
index 0000000..aa87950
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Store/package.md
@@ -0,0 +1,22 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Support for testing store mechanisms. 
+
+The primary class is [](xref:Lucene.Net.Store.MockDirectoryWrapper), which
+wraps any Directory implementation and provides additional checks.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Util/Automaton/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/Automaton/package.md b/src/Lucene.Net.TestFramework/Util/Automaton/package.md
new file mode 100644
index 0000000..c9888f2
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Util/Automaton/package.md
@@ -0,0 +1,20 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Support for testing automata. The primary class is [](xref:Lucene.Net.Util.Automaton.AutomatonTestUtil),
+which can generate random automata, has simplified implementations for testing, etc.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Util/Fst/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/Fst/package.md b/src/Lucene.Net.TestFramework/Util/Fst/package.md
new file mode 100644
index 0000000..f55e1dc
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Util/Fst/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Support for FST testing. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/Util/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/package.md b/src/Lucene.Net.TestFramework/Util/package.md
new file mode 100644
index 0000000..542b6a8
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Util/package.md
@@ -0,0 +1,20 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+General test support.  The primary class is [](xref:Lucene.Net.Util.LuceneTestCase),
+which extends JUnit with additional functionality.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net.TestFramework/overview.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/overview.md b/src/Lucene.Net.TestFramework/overview.md
new file mode 100644
index 0000000..429e1ce
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/overview.md
@@ -0,0 +1,18 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+ The Lucene Test Framework is used by Lucene as the basis for its tests. The framework can also be used for testing third-party code that uses the Lucene API. 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net/Analysis/TokenAttributes/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/package.md b/src/Lucene.Net/Analysis/TokenAttributes/package.md
new file mode 100644
index 0000000..62f1c71
--- /dev/null
+++ b/src/Lucene.Net/Analysis/TokenAttributes/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+General-purpose attributes for text analysis.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net/Analysis/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Analysis/package.md b/src/Lucene.Net/Analysis/package.md
new file mode 100644
index 0000000..861b25f
--- /dev/null
+++ b/src/Lucene.Net/Analysis/package.md
@@ -0,0 +1,780 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+API and code to convert text into indexable/searchable tokens. Covers [](xref:Lucene.Net.Analysis.Analyzer) and related classes.
+
+## Parsing? Tokenization? Analysis!
+
+Lucene, an indexing and search library, accepts only plain text input.
+
+## Parsing
+
+Applications that build their search capabilities upon Lucene may support documents in various formats – HTML, XML, PDF, Word – just to name a few.
+Lucene does not care about the *Parsing* of these and other document formats, and it is the responsibility of the 
+application using Lucene to use an appropriate *Parser* to convert the original format into plain text before passing that plain text to Lucene.
+
+## Tokenization
+
+Plain text passed to Lucene for indexing goes through a process generally called tokenization. Tokenization is the process
+of breaking input text into small indexing elements – tokens.
+The way input text is broken into tokens heavily influences how people will then be able to search for that text. 
+For instance, sentences beginnings and endings can be identified to provide for more accurate phrase 
+and proximity searches (though sentence identification is not provided by Lucene).
+
+ In some cases simply breaking the input text into tokens is not enough – a deeper *Analysis* may be needed. Lucene includes both pre- and post-tokenization analysis facilities. 
+
+ Pre-tokenization analysis can include (but is not limited to) stripping HTML markup, and transforming or removing text matching arbitrary patterns or sets of fixed strings. 
+
+ There are many post-tokenization steps that can be done, including (but not limited to): 
+
+*   [Stemming](http://en.wikipedia.org/wiki/Stemming) – 
+      Replacing words with their stems. 
+      For instance with English stemming "bikes" is replaced with "bike"; 
+      now query "bike" can find both documents containing "bike" and those containing "bikes".
+
+*   [Stop Words Filtering](http://en.wikipedia.org/wiki/Stop_words) – 
+      Common words like "the", "and" and "a" rarely add any value to a search.
+      Removing them shrinks the index size and increases performance.
+      It may also reduce some "noise" and actually improve search quality.
+
+*   [Text Normalization](http://en.wikipedia.org/wiki/Text_normalization) – 
+      Stripping accents and other character markings can make for better searching.
+
+*   [Synonym Expansion](http://en.wikipedia.org/wiki/Synonym) – 
+      Adding in synonyms at the same token position as the current word can mean better 
+      matching when users search with words in the synonym set.
+
+## Core Analysis
+
+ The analysis package provides the mechanism to convert Strings and Readers into tokens that can be indexed by Lucene. There are four main classes in the package from which all analysis processes are derived. These are: 
+
+*   [](xref:Lucene.Net.Analysis.Analyzer) – An Analyzer is 
+    responsible for building a 
+    [](xref:Lucene.Net.Analysis.TokenStream) which can be consumed
+    by the indexing and searching processes.  See below for more information
+    on implementing your own Analyzer.
+
+*   CharFilter – CharFilter extends
+    {@link java.io.Reader} to perform pre-tokenization substitutions, 
+    deletions, and/or insertions on an input Reader's text, while providing
+    corrected character offsets to account for these modifications.  This
+    capability allows highlighting to function over the original text when 
+    indexed tokens are created from CharFilter-modified text with offsets
+    that are not the same as those in the original text. Tokenizers'
+    constructors and reset() methods accept a CharFilter.  CharFilters may
+    be chained to perform multiple pre-tokenization modifications.
+
+*   [](xref:Lucene.Net.Analysis.Tokenizer) – A Tokenizer is a 
+    [](xref:Lucene.Net.Analysis.TokenStream) and is responsible for
+    breaking up incoming text into tokens. In most cases, an Analyzer will
+    use a Tokenizer as the first step in the analysis process.  However,
+    to modify text prior to tokenization, use a CharStream subclass (see
+    above).
+
+*   [](xref:Lucene.Net.Analysis.TokenFilter) – A TokenFilter is
+    also a [](xref:Lucene.Net.Analysis.TokenStream) and is responsible
+    for modifying tokens that have been created by the Tokenizer.  Common 
+    modifications performed by a TokenFilter are: deletion, stemming, synonym 
+    injection, and down casing.  Not all Analyzers require TokenFilters.
+
+## Hints, Tips and Traps
+
+ The synergy between [](xref:Lucene.Net.Analysis.Analyzer) and [](xref:Lucene.Net.Analysis.Tokenizer) is sometimes confusing. To ease this confusion, some clarifications: 
+
+*   The [](xref:Lucene.Net.Analysis.Analyzer) is responsible for the entire task of 
+    <u>creating</u> tokens out of the input text, while the [](xref:Lucene.Net.Analysis.Tokenizer)
+    is only responsible for <u>breaking</u> the input text into tokens. Very likely, tokens created 
+    by the [](xref:Lucene.Net.Analysis.Tokenizer) would be modified or even omitted 
+    by the [](xref:Lucene.Net.Analysis.Analyzer) (via one or more
+    [](xref:Lucene.Net.Analysis.TokenFilter)s) before being returned.
+
+*   [](xref:Lucene.Net.Analysis.Tokenizer) is a [](xref:Lucene.Net.Analysis.TokenStream), 
+    but [](xref:Lucene.Net.Analysis.Analyzer) is not.
+
+*   [](xref:Lucene.Net.Analysis.Analyzer) is "field aware", but 
+    [](xref:Lucene.Net.Analysis.Tokenizer) is not.
+
+ Lucene Java provides a number of analysis capabilities, the most commonly used one being the StandardAnalyzer. Many applications will have a long and industrious life with nothing more than the StandardAnalyzer. However, there are a few other classes/packages that are worth mentioning: 
+
+1.  PerFieldAnalyzerWrapper – Most Analyzers perform the same operation on all
+    [](xref:Lucene.Net.Documents.Field)s.  The PerFieldAnalyzerWrapper can be used to associate a different Analyzer with different
+    [](xref:Lucene.Net.Documents.Field)s.
+
+2.  The analysis library located at the root of the Lucene distribution has a number of different Analyzer implementations to solve a variety
+    of different problems related to searching.  Many of the Analyzers are designed to analyze non-English languages.
+
+3.  There are a variety of Tokenizer and TokenFilter implementations in this package.  Take a look around, chances are someone has implemented what you need.
+
+ Analysis is one of the main causes of performance degradation during indexing. Simply put, the more you analyze the slower the indexing (in most cases). Perhaps your application would be just fine using the simple WhitespaceTokenizer combined with a StopFilter. The benchmark/ library can be useful for testing out the speed of the analysis process. 
+
+## Invoking the Analyzer
+
+ Applications usually do not invoke analysis – Lucene does it for them: 
+
+*   At indexing, as a consequence of 
+    [](xref:Lucene.Net.Index.IndexWriter.AddDocument(Iterable) addDocument(doc)),
+    the Analyzer in effect for indexing is invoked for each indexed field of the added document.
+
+*   At search, a QueryParser may invoke the Analyzer during parsing.  Note that for some queries, analysis does not
+    take place, e.g. wildcard queries.
+
+ However an application might invoke Analysis of any text for testing or for any other purpose, something like: 
+
+        Version matchVersion = Version.LUCENE_XY; // Substitute desired Lucene version for XY
+        Analyzer analyzer = new StandardAnalyzer(matchVersion); // or any other analyzer
+        TokenStream ts = analyzer.tokenStream("myfield", new StringReader("some text goes here"));
+        OffsetAttribute offsetAtt = ts.addAttribute(OffsetAttribute.class);
+
+        try {
+          ts.reset(); // Resets this stream to the beginning. (Required)
+          while (ts.incrementToken()) {
+            // Use [](xref:Lucene.Net.Util.AttributeSource.ReflectAsString(boolean))
+            // for token stream debugging.
+            System.out.println("token: " + ts.reflectAsString(true));
+
+            System.out.println("token start offset: " + offsetAtt.startOffset());
+            System.out.println("  token end offset: " + offsetAtt.endOffset());
+          }
+          ts.end();   // Perform end-of-stream operations, e.g. set the final offset.
+        } finally {
+          ts.close(); // Release resources associated with this stream.
+        }
+
+## Indexing Analysis vs. Search Analysis
+
+ Selecting the "correct" analyzer is crucial for search quality, and can also affect indexing and search performance. The "correct" analyzer differs between applications. Lucene java's wiki page [AnalysisParalysis](http://wiki.apache.org/lucene-java/AnalysisParalysis) provides some data on "analyzing your analyzer". Here are some rules of thumb: 1. Test test test... (did we say test?) 2. Beware of over analysis – might hurt indexing performance. 3. Start with same analyzer for indexing and search, otherwise searches would not find what they are supposed to... 4. In some cases a different analyzer is required for indexing and search, for instance: * Certain searches require more stop words to be filtered. (I.e. more than those that were filtered at indexing.) * Query expansion by synonyms, acronyms, auto spell correction, etc. This might sometimes require a modified analyzer – see the next section on how to do that. 
+
+## Implementing your own Analyzer
+
+ Creating your own Analyzer is straightforward. Your Analyzer can wrap existing analysis components — CharFilter(s) *(optional)*, a Tokenizer, and TokenFilter(s) *(optional)* — or components you create, or a combination of existing and newly created components. Before pursuing this approach, you may find it worthwhile to explore the [analyzers-common]({@docRoot}/../analyzers-common/overview-summary.html) library and/or ask on the [java-user@lucene.apache.org mailing list](http://lucene.apache.org/core/discussion.html) first to see if what you need already exists. If you are still committed to creating your own Analyzer, have a look at the source code of any one of the many samples located in this package. 
+
+ The following sections discuss some aspects of implementing your own analyzer. 
+
+### Field Section Boundaries
+
+ When [](xref:Lucene.Net.Documents.Document.Add(Lucene.Net.Index.IndexableField) document.Add(field)) is called multiple times for the same field name, we could say that each such call creates a new section for that field in that document. In fact, a separate call to [](xref:Lucene.Net.Analysis.Analyzer.TokenStream(java.Lang.String, java.Io.Reader) tokenStream(field,reader)) would take place for each of these so called "sections". However, the default Analyzer behavior is to treat all these sections as one large section. This allows phrase search and proximity search to seamlessly cross boundaries between these "sections". In other words, if a certain field "f" is added like this: 
+
+        document.add(new Field("f","first ends",...);
+        document.add(new Field("f","starts two",...);
+        indexWriter.addDocument(document);
+
+ Then, a phrase search for "ends starts" would find that document. Where desired, this behavior can be modified by introducing a "position gap" between consecutive field "sections", simply by overriding [](xref:Lucene.Net.Analysis.Analyzer.GetPositionIncrementGap(java.Lang.String) Analyzer.GetPositionIncrementGap(fieldName)): 
+
+      Version matchVersion = Version.LUCENE_XY; // Substitute desired Lucene version for XY
+      Analyzer myAnalyzer = new StandardAnalyzer(matchVersion) {
+        public int getPositionIncrementGap(String fieldName) {
+          return 10;
+        }
+      };
+
+### Token Position Increments
+
+ By default, all tokens created by Analyzers and Tokenizers have a [](xref:Lucene.Net.Analysis.TokenAttributes.PositionIncrementAttribute.GetPositionIncrement() position increment) of one. This means that the position stored for that token in the index would be one more than that of the previous token. Recall that phrase and proximity searches rely on position info. 
+
+ If the selected analyzer filters the stop words "is" and "the", then for a document containing the string "blue is the sky", only the tokens "blue", "sky" are indexed, with position("sky") = 3 + position("blue"). Now, a phrase query "blue is the sky" would find that document, because the same analyzer filters the same stop words from that query. But the phrase query "blue sky" would not find that document because the position increment between "blue" and "sky" is only 1. 
+
+ If this behavior does not fit the application needs, the query parser needs to be configured to not take position increments into account when generating phrase queries. 
+
+ Note that a StopFilter MUST increment the position increment in order not to generate corrupt tokenstream graphs. Here is the logic used by StopFilter to increment positions when filtering out tokens: 
+
+      public TokenStream tokenStream(final String fieldName, Reader reader) {
+        final TokenStream ts = someAnalyzer.tokenStream(fieldName, reader);
+        TokenStream res = new TokenStream() {
+          CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
+          PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
+
+          public boolean incrementToken() throws IOException {
+            int extraIncrement = 0;
+            while (true) {
+              boolean hasNext = ts.incrementToken();
+              if (hasNext) {
+                if (stopWords.contains(termAtt.toString())) {
+                  extraIncrement += posIncrAtt.getPositionIncrement(); // filter this word
+                  continue;
+                } 
+                if (extraIncrement>0) {
+                  posIncrAtt.setPositionIncrement(posIncrAtt.getPositionIncrement()+extraIncrement);
+                }
+              }
+              return hasNext;
+            }
+          }
+        };
+        return res;
+      }
+
+ A few more use cases for modifying position increments are: 
+
+1.  Inhibiting phrase and proximity matches in sentence boundaries – for this, a tokenizer that 
+    identifies a new sentence can add 1 to the position increment of the first token of the new sentence.
+2.  Injecting synonyms – here, synonyms of a token should be added after that token, 
+    and their position increment should be set to 0.
+    As result, all synonyms of a token would be considered to appear in exactly the 
+    same position as that token, and so would they be seen by phrase and proximity searches.
+
+### Token Position Length
+
+ By default, all tokens created by Analyzers and Tokenizers have a [](xref:Lucene.Net.Analysis.TokenAttributes.PositionLengthAttribute.GetPositionLength() position length) of one. This means that the token occupies a single position. This attribute is not indexed and thus not taken into account for positional queries, but is used by eg. suggesters. 
+
+ The main use case for positions lengths is multi-word synonyms. With single-word synonyms, setting the position increment to 0 is enough to denote the fact that two words are synonyms, for example: 
+
+<table>
+<tr><td>Term</td><td>red</td><td>magenta</td></tr>
+<tr><td>Position increment</td><td>1</td><td>0</td></tr>
+</table>
+
+ Given that position(magenta) = 0 + position(red), they are at the same position, so anything working with analyzers will return the exact same result if you replace "magenta" with "red" in the input. However, multi-word synonyms are more tricky. Let's say that you want to build a TokenStream where "IBM" is a synonym of "Internal Business Machines". Position increments are not enough anymore: 
+
+<table>
+<tr><td>Term</td><td>IBM</td><td>International</td><td>Business</td><td>Machines</td></tr>
+<tr><td>Position increment</td><td>1</td><td>0</td><td>1</td><td>1</td></tr>
+</table>
+
+ The problem with this token stream is that "IBM" is at the same position as "International" although it is a synonym with "International Business Machines" as a whole. Setting the position increment of "Business" and "Machines" to 0 wouldn't help as it would mean than "International" is a synonym of "Business". The only way to solve this issue is to make "IBM" span across 3 positions, this is where position lengths come to rescue. 
+
+<table>
+<tr><td>Term</td><td>IBM</td><td>International</td><td>Business</td><td>Machines</td></tr>
+<tr><td>Position increment</td><td>1</td><td>0</td><td>1</td><td>1</td></tr>
+<tr><td>Position length</td><td>3</td><td>1</td><td>1</td><td>1</td></tr>
+</table>
+
+ This new attribute makes clear that "IBM" and "International Business Machines" start and end at the same positions. 
+
+### How to not write corrupt token streams
+
+ There are a few rules to observe when writing custom Tokenizers and TokenFilters: 
+
+*   The first position increment must be > 0.
+*   Positions must not go backward.
+*   Tokens that have the same start position must have the same start offset.
+*   Tokens that have the same end position (taking into account the
+  position length) must have the same end offset.
+*   Tokenizers must call [](xref:Lucene.Net.Util.AttributeSource.ClearAttributes()) in
+  incrementToken().
+*   Tokenizers must override [](xref:Lucene.Net.Analysis.TokenStream.End()), and pass the final
+  offset (the total number of input characters processed) to both
+  parameters of [](xref:Lucene.Net.Analysis.TokenAttributes.OffsetAttribute.SetOffset(int, int)).
+
+ Although these rules might seem easy to follow, problems can quickly happen when chaining badly implemented filters that play with positions and offsets, such as synonym or n-grams filters. Here are good practices for writing correct filters: 
+
+*   Token filters should not modify offsets. If you feel that your filter would need to modify offsets, then it should probably be implemented as a tokenizer.
+*   Token filters should not insert positions. If a filter needs to add tokens, then they should all have a position increment of 0.
+*   When they add tokens, token filters should call [](xref:Lucene.Net.Util.AttributeSource.ClearAttributes()) first.
+*   When they remove tokens, token filters should increment the position increment of the following token.
+*   Token filters should preserve position lengths.
+
+## TokenStream API
+
+ "Flexible Indexing" summarizes the effort of making the Lucene indexer pluggable and extensible for custom index formats. A fully customizable indexer means that users will be able to store custom data structures on disk. Therefore an API is necessary that can transport custom types of data from the documents to the indexer. 
+
+### Attribute and AttributeSource
+
+ Classes [](xref:Lucene.Net.Util.Attribute) and [](xref:Lucene.Net.Util.AttributeSource) serve as the basis upon which the analysis elements of "Flexible Indexing" are implemented. An Attribute holds a particular piece of information about a text token. For example, [](xref:Lucene.Net.Analysis.TokenAttributes.CharTermAttribute) contains the term text of a token, and [](xref:Lucene.Net.Analysis.TokenAttributes.OffsetAttribute) contains the start and end character offsets of a token. An AttributeSource is a collection of Attributes with a restriction: there may be only one instance of each attribute type. TokenStream now extends AttributeSource, which means that one can add Attributes to a TokenStream. Since TokenFilter extends TokenStream, all filters are also AttributeSources. 
+
+ Lucene provides seven Attributes out of the box: 
+
+<table rules="all" frame="box" cellpadding="3">
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.CharTermAttribute)</td>
+    <td>
+      The term text of a token.  Implements {@link java.lang.CharSequence} 
+      (providing methods length() and charAt(), and allowing e.g. for direct
+      use with regular expression {@link java.util.regex.Matcher}s) and 
+      {@link java.lang.Appendable} (allowing the term text to be appended to.)
+    </td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.OffsetAttribute)</td>
+    <td>The start and end offset of a token in characters.</td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.PositionIncrementAttribute)</td>
+    <td>See above for detailed information about position increment.</td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.PositionLengthAttribute)</td>
+    <td>The number of positions occupied by a token.</td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.PayloadAttribute)</td>
+    <td>The payload that a Token can optionally have.</td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.TypeAttribute)</td>
+    <td>The type of the token. Default is 'word'.</td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.FlagsAttribute)</td>
+    <td>Optional flags a token can have.</td>
+  </tr>
+  <tr>
+    <td>[](xref:Lucene.Net.Analysis.TokenAttributes.KeywordAttribute)</td>
+    <td>
+      Keyword-aware TokenStreams/-Filters skip modification of tokens that
+      return true from this attribute's isKeyword() method. 
+    </td>
+  </tr>
+</table>
+
+### More Requirements for Analysis Component Classes
+
+Due to the historical development of the API, there are some perhaps
+less than obvious requirements to implement analysis components
+classes.
+
+#### Token Stream Lifetime
+
+The code fragment of the [analysis workflow
+protocol](#analysis-workflow) above shows a token stream being obtained, used, and then
+left for garbage. However, that does not mean that the components of
+that token stream will, in fact, be discarded. The default is just the
+opposite. [](xref:Lucene.Net.Analysis.Analyzer) applies a reuse
+strategy to the tokenizer and the token filters. It will reuse
+them. For each new input, it calls [](xref:Lucene.Net.Analysis.Tokenizer.SetReader(java.Io.Reader)) 
+to set the input. Your components must be prepared for this scenario,
+as described below.
+
+#### Tokenizer
+
+*   You should create your tokenizer class by extending [](xref:Lucene.Net.Analysis.Tokenizer).
+
+*   Your tokenizer must **never** make direct use of the
+  {@link java.io.Reader} supplied to its constructor(s). (A future
+  release of Apache Lucene may remove the reader parameters from the
+  Tokenizer constructors.)
+  [](xref:Lucene.Net.Analysis.Tokenizer) wraps the reader in an
+  object that helps enforce that applications comply with the [analysis workflow](#analysis-workflow). Thus, your class
+  should only reference the input via the protected 'input' field
+  of Tokenizer.
+
+*   Your tokenizer **must** override [](xref:Lucene.Net.Analysis.TokenStream.End()).
+  Your implementation **must** call
+  `super.end()`. It must set a correct final offset into
+  the offset attribute, and finish up and other attributes to reflect
+  the end of the stream.
+
+*   If your tokenizer overrides [](xref:Lucene.Net.Analysis.TokenStream.Reset())
+  or [](xref:Lucene.Net.Analysis.TokenStream.Close()), it
+    **must** call the corresponding superclass method.
+
+#### Token Filter
+
+  You should create your token filter class by extending [](xref:Lucene.Net.Analysis.TokenFilter).
+  If your token filter overrides [](xref:Lucene.Net.Analysis.TokenStream.Reset()),
+  [](xref:Lucene.Net.Analysis.TokenStream.End())
+  or [](xref:Lucene.Net.Analysis.TokenStream.Close()), it
+  **must** call the corresponding superclass method.
+
+#### Creating delegates
+
+  Forwarding classes (those which extend [](xref:Lucene.Net.Analysis.Tokenizer) but delegate
+  selected logic to another tokenizer) must also set the reader to the delegate in the overridden
+  [](xref:Lucene.Net.Analysis.Tokenizer.Reset()) method, e.g.:
+
+        public class ForwardingTokenizer extends Tokenizer {
+           private Tokenizer delegate;
+           ...
+           {@literal @Override}
+           public void reset() {
+              super.reset();
+              delegate.setReader(this.input);
+              delegate.reset();
+           }
+        }
+
+### Testing Your Analysis Component
+
+ The lucene-test-framework component defines [BaseTokenStreamTestCase]({@docRoot}/../test-framework/org/apache/lucene/analysis/BaseTokenStreamTestCase.html). By extending this class, you can create JUnit tests that validate that your Analyzer and/or analysis components correctly implement the protocol. The checkRandomData methods of that class are particularly effective in flushing out errors. 
+
+### Using the TokenStream API
+
+There are a few important things to know in order to use the new API efficiently which are summarized here. You may want
+to walk through the example below first and come back to this section afterwards.
+
+1.  Please keep in mind that an AttributeSource can only have one instance of a particular Attribute. Furthermore, if 
+a chain of a TokenStream and multiple TokenFilters is used, then all TokenFilters in that chain share the Attributes
+with the TokenStream.
+
+2.    
+
+Attribute instances are reused for all tokens of a document. Thus, a TokenStream/-Filter needs to update
+the appropriate Attribute(s) in incrementToken(). The consumer, commonly the Lucene indexer, consumes the data in the
+Attributes and then calls incrementToken() again until it returns false, which indicates that the end of the stream
+was reached. This means that in each call of incrementToken() a TokenStream/-Filter can safely overwrite the data in
+the Attribute instances.
+
+3.    
+
+For performance reasons a TokenStream/-Filter should add/get Attributes during instantiation; i.e., create an attribute in the
+constructor and store references to it in an instance variable.  Using an instance variable instead of calling addAttribute()/getAttribute() 
+in incrementToken() will avoid attribute lookups for every token in the document.
+
+4.    
+
+All methods in AttributeSource are idempotent, which means calling them multiple times always yields the same
+result. This is especially important to know for addAttribute(). The method takes the **type** (`Class`)
+of an Attribute as an argument and returns an **instance**. If an Attribute of the same type was previously added, then
+the already existing instance is returned, otherwise a new instance is created and returned. Therefore TokenStreams/-Filters
+can safely call addAttribute() with the same Attribute type multiple times. Even consumers of TokenStreams should
+normally call addAttribute() instead of getAttribute(), because it would not fail if the TokenStream does not have this
+Attribute (getAttribute() would throw an IllegalArgumentException, if the Attribute is missing). More advanced code
+could simply check with hasAttribute(), if a TokenStream has it, and may conditionally leave out processing for
+extra performance.
+
+### Example
+
+ In this example we will create a WhiteSpaceTokenizer and use a LengthFilter to suppress all words that have only two or fewer characters. The LengthFilter is part of the Lucene core and its implementation will be explained here to illustrate the usage of the TokenStream API. 
+
+ Then we will develop a custom Attribute, a PartOfSpeechAttribute, and add another filter to the chain which utilizes the new custom attribute, and call it PartOfSpeechTaggingFilter. 
+
+#### Whitespace tokenization
+
+    public class MyAnalyzer extends Analyzer {
+
+      private Version matchVersion;
+
+      public MyAnalyzer(Version matchVersion) {
+        this.matchVersion = matchVersion;
+      }
+
+      {@literal @Override}
+      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
+        return new TokenStreamComponents(new WhitespaceTokenizer(matchVersion, reader));
+      }
+
+      public static void main(String[] args) throws IOException {
+        // text to tokenize
+        final String text = "This is a demo of the TokenStream API";
+
+        Version matchVersion = Version.LUCENE_XY; // Substitute desired Lucene version for XY
+        MyAnalyzer analyzer = new MyAnalyzer(matchVersion);
+        TokenStream stream = analyzer.tokenStream("field", new StringReader(text));
+
+        // get the CharTermAttribute from the TokenStream
+        CharTermAttribute termAtt = stream.addAttribute(CharTermAttribute.class);
+
+        try {
+          stream.reset();
+
+          // print all tokens until stream is exhausted
+          while (stream.incrementToken()) {
+            System.out.println(termAtt.toString());
+          }
+
+          stream.end();
+        } finally {
+          stream.close();
+        }
+      }
+    }
+
+In this easy example a simple white space tokenization is performed. In main() a loop consumes the stream and
+prints the term text of the tokens by accessing the CharTermAttribute that the WhitespaceTokenizer provides. 
+Here is the output:
+
+    This
+    is
+    a
+    demo
+    of
+    the
+    new
+    TokenStream
+    API
+
+#### Adding a LengthFilter
+
+We want to suppress all tokens that have 2 or less characters. We can do that
+easily by adding a LengthFilter to the chain. Only the
+`createComponents()` method in our analyzer needs to be changed:
+
+      {@literal @Override}
+      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
+        final Tokenizer source = new WhitespaceTokenizer(matchVersion, reader);
+        TokenStream result = new LengthFilter(true, source, 3, Integer.MAX_VALUE);
+        return new TokenStreamComponents(source, result);
+      }
+
+Note how now only words with 3 or more characters are contained in the output:
+
+    This
+    demo
+    the
+    new
+    TokenStream
+    API
+
+Now let's take a look how the LengthFilter is implemented:
+
+    public final class LengthFilter extends FilteringTokenFilter {
+
+      private final int min;
+      private final int max;
+
+      private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
+
+      /**
+       * Create a new LengthFilter. This will filter out tokens whose
+       * CharTermAttribute is either too short
+       * (< min) or too long (> max).
+       * @param version the Lucene match version
+       * @param in      the TokenStream to consume
+       * @param min     the minimum length
+       * @param max     the maximum length
+       */
+      public LengthFilter(Version version, TokenStream in, int min, int max) {
+        super(version, in);
+        this.min = min;
+        this.max = max;
+      }
+
+      {@literal @Override}
+      public boolean accept() {
+        final int len = termAtt.length();
+        return (len >= min && len <= max);="" }="" }=""></=>
+
+ In LengthFilter, the CharTermAttribute is added and stored in the instance variable `termAtt`. Remember that there can only be a single instance of CharTermAttribute in the chain, so in our example the `addAttribute()` call in LengthFilter returns the CharTermAttribute that the WhitespaceTokenizer already added. 
+
+ The tokens are retrieved from the input stream in FilteringTokenFilter's `incrementToken()` method (see below), which calls LengthFilter's `accept()` method. By looking at the term text in the CharTermAttribute, the length of the term can be determined and tokens that are either too short or too long are skipped. Note how `accept()` can efficiently access the instance variable; no attribute lookup is necessary. The same is true for the consumer, which can simply use local references to the Attributes. 
+
+ LengthFilter extends FilteringTokenFilter: 
+
+    public abstract class FilteringTokenFilter extends TokenFilter {
+
+      private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
+
+      /**
+       * Create a new FilteringTokenFilter.
+       * @param in      the TokenStream to consume
+       */
+      public FilteringTokenFilter(Version version, TokenStream in) {
+        super(in);
+      }
+
+      /** Override this method and return if the current input token should be returned by incrementToken. */
+      protected abstract boolean accept() throws IOException;
+
+      {@literal @Override}
+      public final boolean incrementToken() throws IOException {
+        int skippedPositions = 0;
+        while (input.incrementToken()) {
+          if (accept()) {
+            if (skippedPositions != 0) {
+              posIncrAtt.setPositionIncrement(posIncrAtt.getPositionIncrement() + skippedPositions);
+            }
+            return true;
+          }
+          skippedPositions += posIncrAtt.getPositionIncrement();
+        }
+        // reached EOS -- return false
+        return false;
+      }
+
+      {@literal @Override}
+      public void reset() throws IOException {
+        super.reset();
+      }
+
+    }
+
+#### Adding a custom Attribute
+
+Now we're going to implement our own custom Attribute for part-of-speech tagging and call it consequently 
+`PartOfSpeechAttribute`. First we need to define the interface of the new Attribute:
+
+      public interface PartOfSpeechAttribute extends Attribute {
+        public static enum PartOfSpeech {
+          Noun, Verb, Adjective, Adverb, Pronoun, Preposition, Conjunction, Article, Unknown
+        }
+
+        public void setPartOfSpeech(PartOfSpeech pos);
+
+        public PartOfSpeech getPartOfSpeech();
+      }
+
+ Now we also need to write the implementing class. The name of that class is important here: By default, Lucene checks if there is a class with the name of the Attribute with the suffix 'Impl'. In this example, we would consequently call the implementing class `PartOfSpeechAttributeImpl`. 
+
+ This should be the usual behavior. However, there is also an expert-API that allows changing these naming conventions: [](xref:Lucene.Net.Util.AttributeSource.AttributeFactory). The factory accepts an Attribute interface as argument and returns an actual instance. You can implement your own factory if you need to change the default behavior. 
+
+ Now here is the actual class that implements our new Attribute. Notice that the class has to extend [](xref:Lucene.Net.Util.AttributeImpl): 
+
+    public final class PartOfSpeechAttributeImpl extends AttributeImpl 
+                                      implements PartOfSpeechAttribute {
+
+      private PartOfSpeech pos = PartOfSpeech.Unknown;
+
+      public void setPartOfSpeech(PartOfSpeech pos) {
+        this.pos = pos;
+      }
+
+      public PartOfSpeech getPartOfSpeech() {
+        return pos;
+      }
+
+      {@literal @Override}
+      public void clear() {
+        pos = PartOfSpeech.Unknown;
+      }
+
+      {@literal @Override}
+      public void copyTo(AttributeImpl target) {
+        ((PartOfSpeechAttribute) target).setPartOfSpeech(pos);
+      }
+    }
+
+ This is a simple Attribute implementation has only a single variable that stores the part-of-speech of a token. It extends the `AttributeImpl` class and therefore implements its abstract methods `clear()` and `copyTo()`. Now we need a TokenFilter that can set this new PartOfSpeechAttribute for each token. In this example we show a very naive filter that tags every word with a leading upper-case letter as a 'Noun' and all other words as 'Unknown'. 
+
+      public static class PartOfSpeechTaggingFilter extends TokenFilter {
+        PartOfSpeechAttribute posAtt = addAttribute(PartOfSpeechAttribute.class);
+        CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
+
+        protected PartOfSpeechTaggingFilter(TokenStream input) {
+          super(input);
+        }
+
+        public boolean incrementToken() throws IOException {
+          if (!input.incrementToken()) {return false;}
+          posAtt.setPartOfSpeech(determinePOS(termAtt.buffer(), 0, termAtt.length()));
+          return true;
+        }
+
+        // determine the part of speech for the given term
+        protected PartOfSpeech determinePOS(char[] term, int offset, int length) {
+          // naive implementation that tags every uppercased word as noun
+          if (length > 0 && Character.isUpperCase(term[0])) {
+            return PartOfSpeech.Noun;
+          }
+          return PartOfSpeech.Unknown;
+        }
+      }
+
+ Just like the LengthFilter, this new filter stores references to the attributes it needs in instance variables. Notice how you only need to pass in the interface of the new Attribute and instantiating the correct class is automatically taken care of. 
+
+Now we need to add the filter to the chain in MyAnalyzer:
+
+      {@literal @Override}
+      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
+        final Tokenizer source = new WhitespaceTokenizer(matchVersion, reader);
+        TokenStream result = new LengthFilter(true, source, 3, Integer.MAX_VALUE);
+        result = new PartOfSpeechTaggingFilter(result);
+        return new TokenStreamComponents(source, result);
+      }
+
+Now let's look at the output:
+
+    This
+    demo
+    the
+    new
+    TokenStream
+    API
+
+Apparently it hasn't changed, which shows that adding a custom attribute to a TokenStream/Filter chain does not
+affect any existing consumers, simply because they don't know the new Attribute. Now let's change the consumer
+to make use of the new PartOfSpeechAttribute and print it out:
+
+      public static void main(String[] args) throws IOException {
+        // text to tokenize
+        final String text = "This is a demo of the TokenStream API";
+
+        MyAnalyzer analyzer = new MyAnalyzer();
+        TokenStream stream = analyzer.tokenStream("field", new StringReader(text));
+
+        // get the CharTermAttribute from the TokenStream
+        CharTermAttribute termAtt = stream.addAttribute(CharTermAttribute.class);
+
+        // get the PartOfSpeechAttribute from the TokenStream
+        PartOfSpeechAttribute posAtt = stream.addAttribute(PartOfSpeechAttribute.class);
+
+        try {
+          stream.reset();
+
+          // print all tokens until stream is exhausted
+          while (stream.incrementToken()) {
+            System.out.println(termAtt.toString() + ": " + posAtt.getPartOfSpeech());
+          }
+
+          stream.end();
+        } finally {
+          stream.close();
+        }
+      }
+
+The change that was made is to get the PartOfSpeechAttribute from the TokenStream and print out its contents in
+the while loop that consumes the stream. Here is the new output:
+
+    This: Noun
+    demo: Unknown
+    the: Unknown
+    new: Unknown
+    TokenStream: Noun
+    API: Noun
+
+Each word is now followed by its assigned PartOfSpeech tag. Of course this is a naive 
+part-of-speech tagging. The word 'This' should not even be tagged as noun; it is only spelled capitalized because it
+is the first word of a sentence. Actually this is a good opportunity for an exercise. To practice the usage of the new
+API the reader could now write an Attribute and TokenFilter that can specify for each word if it was the first token
+of a sentence or not. Then the PartOfSpeechTaggingFilter can make use of this knowledge and only tag capitalized words
+as nouns if not the first word of a sentence (we know, this is still not a correct behavior, but hey, it's a good exercise). 
+As a small hint, this is how the new Attribute class could begin:
+
+      public class FirstTokenOfSentenceAttributeImpl extends AttributeImpl
+                                  implements FirstTokenOfSentenceAttribute {
+
+        private boolean firstToken;
+
+        public void setFirstToken(boolean firstToken) {
+          this.firstToken = firstToken;
+        }
+
+        public boolean getFirstToken() {
+          return firstToken;
+        }
+
+        {@literal @Override}
+        public void clear() {
+          firstToken = false;
+        }
+
+      ...
+
+#### Adding a CharFilter chain
+
+Analyzers take Java {@link java.io.Reader}s as input. Of course you can wrap your Readers with {@link java.io.FilterReader}s
+to manipulate content, but this would have the big disadvantage that character offsets might be inconsistent with your original
+text.
+
+[](xref:Lucene.Net.Analysis.CharFilter) is designed to allow you to pre-process input like a FilterReader would, but also
+preserve the original offsets associated with those characters. This way mechanisms like highlighting still work correctly.
+CharFilters can be chained.
+
+Example:
+
+    public class MyAnalyzer extends Analyzer {
+
+      {@literal @Override}
+      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
+        return new TokenStreamComponents(new MyTokenizer(reader));
+      }
+
+      {@literal @Override}
+      protected Reader initReader(String fieldName, Reader reader) {
+        // wrap the Reader in a CharFilter chain.
+        return new SecondCharFilter(new FirstCharFilter(reader));
+      }
+    }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net/Codecs/Compressing/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Compressing/package.md b/src/Lucene.Net/Codecs/Compressing/package.md
new file mode 100644
index 0000000..0216013
--- /dev/null
+++ b/src/Lucene.Net/Codecs/Compressing/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+StoredFieldsFormat that allows cross-document and cross-field compression of stored fields.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net/Codecs/Lucene3x/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene3x/package.md b/src/Lucene.Net/Codecs/Lucene3x/package.md
new file mode 100644
index 0000000..ff55d41
--- /dev/null
+++ b/src/Lucene.Net/Codecs/Lucene3x/package.md
@@ -0,0 +1,19 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Codec to support Lucene 3.x indexes (readonly)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6a95ad43/src/Lucene.Net/Codecs/Lucene40/package.md
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene40/package.md b/src/Lucene.Net/Codecs/Lucene40/package.md
new file mode 100644
index 0000000..7cf4475
--- /dev/null
+++ b/src/Lucene.Net/Codecs/Lucene40/package.md
@@ -0,0 +1,337 @@
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Lucene 4.0 file format.
+
+# Apache Lucene - Index File Formats
+
+<div>
+
+*   [Introduction](#Introduction)
+*   [Definitions](#Definitions)
+
+    *   [Inverted Indexing](#Inverted_Indexing)
+    *   [Types of Fields](#Types_of_Fields)
+    *   [Segments](#Segments)
+    *   [Document Numbers](#Document_Numbers)
+
+*   [Index Structure Overview](#Overview)
+*   [File Naming](#File_Naming)
+*   [Summary of File Extensions](#file-names)
+*   *   [Lock File](#Lock_File)
+    *   [History](#History)
+    *   [Limitations](#Limitations)
+
+</div>
+
+## Introduction
+
+<div>
+
+This document defines the index file formats used in this version of Lucene. If you are using a different version of Lucene, please consult the copy of `docs/` that was distributed with the version you are using.
+
+Apache Lucene is written in Java, but several efforts are underway to write [versions of Lucene in other programming languages](http://wiki.apache.org/lucene-java/LuceneImplementations). If these versions are to remain compatible with Apache Lucene, then a language-independent definition of the Lucene index format is required. This document thus attempts to provide a complete and independent definition of the Apache Lucene file formats.
+
+As Lucene evolves, this document should evolve. Versions of Lucene in different programming languages should endeavor to agree on file formats, and generate new versions of this document.
+
+</div>
+
+## Definitions
+
+<div>
+
+The fundamental concepts in Lucene are index, document, field and term.
+
+An index contains a sequence of documents.
+
+*   A document is a sequence of fields.
+*   A field is a named sequence of terms.
+*   A term is a sequence of bytes.
+
+The same sequence of bytes in two different fields is considered a different term. Thus terms are represented as a pair: the string naming the field, and the bytes within the field.
+
+### Inverted Indexing
+
+The index stores statistics about terms in order to make term-based search more efficient. Lucene's index falls into the family of indexes known as an *inverted index.* This is because it can list, for a term, the documents that contain it. This is the inverse of the natural relationship, in which documents list terms.
+
+### Types of Fields
+
+In Lucene, fields may be *stored*, in which case their text is stored in the index literally, in a non-inverted manner. Fields that are inverted are called *indexed*. A field may be both stored and indexed.
+
+The text of a field may be *tokenized* into terms to be indexed, or the text of a field may be used literally as a term to be indexed. Most fields are tokenized, but sometimes it is useful for certain identifier fields to be indexed literally.
+
+See the [](xref:Lucene.Net.Documents.Field Field) java docs for more information on Fields.
+
+### Segments
+
+Lucene indexes may be composed of multiple sub-indexes, or *segments*. Each segment is a fully independent index, which could be searched separately. Indexes evolve by:
+
+1.  Creating new segments for newly added documents.
+2.  Merging existing segments.
+
+Searches may involve multiple segments and/or multiple indexes, each index potentially composed of a set of segments.
+
+### Document Numbers
+
+Internally, Lucene refers to documents by an integer *document number*. The first document added to an index is numbered zero, and each subsequent document added gets a number one greater than the previous.
+
+Note that a document's number may change, so caution should be taken when storing these numbers outside of Lucene. In particular, numbers may change in the following situations:
+
+*   
+
+The numbers stored in each segment are unique only within the segment, and must be converted before they can be used in a larger context. The standard technique is to allocate each segment a range of values, based on the range of numbers used in that segment. To convert a document number from a segment to an external value, the segment's *base* document number is added. To convert an external value back to a segment-specific value, the segment is identified by the range that the external value is in, and the segment's base value is subtracted. For example two five document segments might be combined, so that the first segment has a base value of zero, and the second of five. Document three from the second segment would have an external value of eight.
+
+*   
+
+When documents are deleted, gaps are created in the numbering. These are eventually removed as the index evolves through merging. Deleted documents are dropped when segments are merged. A freshly-merged segment thus has no gaps in its numbering.
+
+</div>
+
+## Index Structure Overview
+
+<div>
+
+Each segment index maintains the following:
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40SegmentInfoFormat Segment info).
+   This contains metadata about a segment, such as the number of documents,
+   what files it uses, 
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40FieldInfosFormat Field names). 
+   This contains the set of field names used in the index.
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40StoredFieldsFormat Stored Field values). 
+This contains, for each document, a list of attribute-value pairs, where the attributes 
+are field names. These are used to store auxiliary information about the document, such as 
+its title, url, or an identifier to access a database. The set of stored fields are what is 
+returned for each hit when searching. This is keyed by document number.
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Term dictionary). 
+A dictionary containing all of the terms used in all of the
+indexed fields of all of the documents. The dictionary also contains the number
+of documents which contain the term, and pointers to the term's frequency and
+proximity data.
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Term Frequency data). 
+For each term in the dictionary, the numbers of all the
+documents that contain that term, and the frequency of the term in that
+document, unless frequencies are omitted (IndexOptions.DOCS_ONLY)
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Term Proximity data). 
+For each term in the dictionary, the positions that the
+term occurs in each document. Note that this will not exist if all fields in
+all documents omit position data.
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40NormsFormat Normalization factors). 
+For each field in each document, a value is stored
+that is multiplied into the score for hits on that field.
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40TermVectorsFormat Term Vectors). 
+For each field in each document, the term vector (sometimes
+called document vector) may be stored. A term vector consists of term text and
+term frequency. To add Term Vectors to your index see the 
+[](xref:Lucene.Net.Documents.Field Field) constructors
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40DocValuesFormat Per-document values). 
+Like stored values, these are also keyed by document
+number, but are generally intended to be loaded into main memory for fast
+access. Whereas stored values are generally intended for summary results from
+searches, per-document values are useful for things like scoring factors.
+
+*   [](xref:Lucene.Net.Codecs.Lucene40.Lucene40LiveDocsFormat Deleted documents). 
+An optional file indicating which documents are deleted.
+
+Details on each of these are provided in their linked pages.
+
+</div>
+
+## File Naming
+
+<div>
+
+All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats described below. When using the Compound File format (default in 1.4 and greater) these files (except for the Segment info file, the Lock file, and Deleted documents file) are collapsed into a single .cfs file (see below for details)
+
+Typically, all segments in an index are stored in a single directory, although this is not required.
+
+As of version 2.1 (lock-less commits), file names are never re-used (there is one exception, "segments.gen", see below). That is, when any file is saved to the Directory it is given a never before used filename. This is achieved using a simple generations approach. For example, the first segments file is segments_1, then segments_2, etc. The generation is a sequential long integer represented in alpha-numeric (base 36) form.
+
+</div>
+
+## Summary of File Extensions
+
+<div>
+
+The following table summarizes the names and extensions of the files in Lucene:
+
+<table cellspacing="1" cellpadding="4">
+<tr>
+<th>Name</th>
+<th>Extension</th>
+<th>Brief Description</th>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Index.SegmentInfos Segments File)</td>
+<td>segments.gen, segments_N</td>
+<td>Stores information about a commit point</td>
+</tr>
+<tr>
+<td>[Lock File](#Lock_File)</td>
+<td>write.lock</td>
+<td>The Write lock prevents multiple IndexWriters from writing to the same
+file.</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40SegmentInfoFormat Segment Info)</td>
+<td>.si</td>
+<td>Stores metadata about a segment</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Store.CompoundFileDirectory Compound File)</td>
+<td>.cfs, .cfe</td>
+<td>An optional "virtual" file consisting of all the other index files for
+systems that frequently run out of file handles.</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40FieldInfosFormat Fields)</td>
+<td>.fnm</td>
+<td>Stores information about the fields</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40StoredFieldsFormat Field Index)</td>
+<td>.fdx</td>
+<td>Contains pointers to field data</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40StoredFieldsFormat Field Data)</td>
+<td>.fdt</td>
+<td>The stored fields for documents</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Term Dictionary)</td>
+<td>.tim</td>
+<td>The term dictionary, stores term info</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Term Index)</td>
+<td>.tip</td>
+<td>The index into the Term Dictionary</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Frequencies)</td>
+<td>.frq</td>
+<td>Contains the list of docs which contain each term along with frequency</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat Positions)</td>
+<td>.prx</td>
+<td>Stores position information about where a term occurs in the index</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40NormsFormat Norms)</td>
+<td>.nrm.cfs, .nrm.cfe</td>
+<td>Encodes length and boost factors for docs and fields</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40DocValuesFormat Per-Document Values)</td>
+<td>.dv.cfs, .dv.cfe</td>
+<td>Encodes additional scoring factors or other per-document information.</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40TermVectorsFormat Term Vector Index)</td>
+<td>.tvx</td>
+<td>Stores offset into the document data file</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40TermVectorsFormat Term Vector Documents)</td>
+<td>.tvd</td>
+<td>Contains information about each document that has term vectors</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40TermVectorsFormat Term Vector Fields)</td>
+<td>.tvf</td>
+<td>The field level info about term vectors</td>
+</tr>
+<tr>
+<td>[](xref:Lucene.Net.Codecs.Lucene40.Lucene40LiveDocsFormat Deleted Documents)</td>
+<td>.del</td>
+<td>Info about what files are deleted</td>
+</tr>
+</table>
+</div>
+
+## Lock File
+
+The write lock, which is stored in the index directory by default, is named
+"write.lock". If the lock directory is different from the index directory then
+the write lock will be named "XXXX-write.lock" where XXXX is a unique prefix
+derived from the full path to the index directory. When this file is present, a
+writer is currently modifying the index (adding or removing documents). This
+lock file ensures that only one writer is modifying the index at a time.
+
+## History
+
+Compatibility notes are provided in this document, describing how file formats have changed from prior versions:
+
+*   In version 2.1, the file format was changed to allow lock-less commits (ie,
+no more commit lock). The change is fully backwards compatible: you can open a
+pre-2.1 index for searching or adding/deleting of docs. When the new segments
+file is saved (committed), it will be written in the new file format (meaning
+no specific "upgrade" process is needed). But note that once a commit has
+occurred, pre-2.1 Lucene will not be able to read the index.
+*   In version 2.3, the file format was changed to allow segments to share a
+single set of doc store (vectors & stored fields) files. This allows for
+faster indexing in certain cases. The change is fully backwards compatible (in
+the same way as the lock-less commits change in 2.1).
+*   In version 2.4, Strings are now written as true UTF-8 byte sequence, not
+Java's modified UTF-8. See [
+LUCENE-510](http://issues.apache.org/jira/browse/LUCENE-510) for details.
+*   In version 2.9, an optional opaque Map<String,String> CommitUserData
+may be passed to IndexWriter's commit methods (and later retrieved), which is
+recorded in the segments_N file. See [
+LUCENE-1382](http://issues.apache.org/jira/browse/LUCENE-1382) for details. Also,
+diagnostics were added to each segment written recording details about why it
+was written (due to flush, merge; which OS/JRE was used; etc.). See issue
+[LUCENE-1654](http://issues.apache.org/jira/browse/LUCENE-1654) for details.
+*   In version 3.0, compressed fields are no longer written to the index (they
+can still be read, but on merge the new segment will write them, uncompressed).
+See issue [LUCENE-1960](http://issues.apache.org/jira/browse/LUCENE-1960) 
+for details.
+*   In version 3.1, segments records the code version that created them. See
+[LUCENE-2720](http://issues.apache.org/jira/browse/LUCENE-2720) for details. 
+Additionally segments track explicitly whether or not they have term vectors. 
+See [LUCENE-2811](http://issues.apache.org/jira/browse/LUCENE-2811) 
+for details.
+*   In version 3.2, numeric fields are written as natively to stored fields
+file, previously they were stored in text format only.
+*   In version 3.4, fields can omit position data while still indexing term
+frequencies.
+*   In version 4.0, the format of the inverted index became extensible via
+the [](xref:Lucene.Net.Codecs.Codec Codec) api. Fast per-document storage
+({@code DocValues}) was introduced. Normalization factors need no longer be a 
+single byte, they can be any [](xref:Lucene.Net.Index.NumericDocValues NumericDocValues). 
+Terms need not be unicode strings, they can be any byte sequence. Term offsets 
+can optionally be indexed into the postings lists. Payloads can be stored in the 
+term vectors.
+
+## Limitations
+
+<div>
+
+Lucene uses a Java `int` to refer to document numbers, and the index file format uses an `Int32` on-disk to store document numbers. This is a limitation of both the index file format and the current implementation. Eventually these should be replaced with either `UInt64` values, or better yet, [](xref:Lucene.Net.Store.DataOutput.WriteVInt VInt) values which have no limit.
+
+</div>
\ No newline at end of file


Mime
View raw message