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: Ported QueryParser.Xml + tests
Date Wed, 07 Dec 2016 13:48:24 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/LikeThisQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/LikeThisQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/LikeThisQuery.xml
new file mode 100644
index 0000000..3e881fb
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/LikeThisQuery.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<LikeThisQuery percentTermsToMatch="5" stopWords="Reuter" minDocFreq="2">
+IRAQI TROOPS REPORTED PUSHING BACK IRANIANS Iraq said today its troops were pushing Iranian
forces out of 
+	positions they had initially occupied when they launched a new offensive near the southern
port of 
+	Basra early yesterday.     A High Command communique said Iraqi troops had won a significant
victory 
+	and were continuing to advance.     Iraq said it had foiled a three-pronged thrust some
10 km 
+	(six miles) from Basra, but admitted the Iranians had occupied ground held by the Mohammed
al-Qassem 
+	unit, one of three divisions attacked.     The communique said Iranian Revolutionary Guards
were under 
+	assault from warplanes, helicopter gunships, heavy artillery and tanks.     "Our forces
are continuing 
+	their advance until they purge the last foothold" occupied by the Iranians, it said.   
 
+	(Iran said its troops had killed or wounded more than 4,000 Iraqis and were stabilising
their new positions.)     
+	The Baghdad communique said Iraqi planes also destroyed oil installations at Iran's southwestern
Ahvaz field 
+	during a raid today. It denied an Iranian report that an Iraqi jet was shot down.     
+	Iraq also reported a naval battle at the northern tip of the Gulf. Iraqi naval units and
forces defending an 
+	offshore terminal sank six Iranian out of 28 Iranian boats attempting to attack an offshore
terminal, 
+	the communique said.      Reuter 3;
+</LikeThisQuery>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/MatchAllDocsQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/MatchAllDocsQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/MatchAllDocsQuery.xml
new file mode 100644
index 0000000..526513f
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/MatchAllDocsQuery.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<FilteredQuery>
+	<Query>
+		<MatchAllDocsQuery/>
+	</Query>
+	
+	<Filter>
+		<RangeFilter fieldName="date" lowerTerm="19870409" upperTerm="19870412"/>
+	</Filter>
+	
+</FilteredQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/NestedBooleanQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/NestedBooleanQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/NestedBooleanQuery.xml
new file mode 100644
index 0000000..0cc4c80
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/NestedBooleanQuery.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!--
+	This query was added to demonstrate nested boolean queries - there
+	was a bug in the XML parser which added ALL child <Clause> tags to 
+	the top level tags ie. took child and grandchild elements instead
+	of just child elements. This was due to the use of the 
+	Element.getElementsByTagName() call in BooleanQueryBuilder
+-->	
+<BooleanQuery fieldName="contents">	
+	<Clause occurs="should">
+		<BooleanQuery fieldName="contents">
+			<Clause occurs="must">
+				<TermQuery>doesNotExistButShouldBeOKBecauseOtherClauseExists</TermQuery>
+			</Clause>
+		</BooleanQuery>
+	</Clause>
+	<Clause occurs="should">
+		<TermQuery>bank</TermQuery>
+	</Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeFilterQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeFilterQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeFilterQuery.xml
new file mode 100644
index 0000000..054d185
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeFilterQuery.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<FilteredQuery>
+	<Query>
+		<BooleanQuery fieldName="contents">
+			<Clause occurs="should">
+				<TermQuery>merger</TermQuery>
+			</Clause>
+			<Clause occurs="mustnot">
+				<TermQuery >sumitomo</TermQuery>		
+			</Clause>
+			<Clause occurs="must">
+				<TermQuery>bank</TermQuery>
+			</Clause>
+		</BooleanQuery>
+	</Query>
+	
+	<Filter>
+		<NumericRangeFilter fieldName="date2" lowerTerm="19870409" upperTerm="19870412"/>
+	</Filter>
+	
+</FilteredQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeQueryQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeQueryQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeQueryQuery.xml
new file mode 100644
index 0000000..416adbd
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/NumericRangeQueryQuery.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<BooleanQuery fieldName="contents">
+	<Clause occurs="should">
+		<TermQuery>merger</TermQuery>
+	</Clause>
+	<Clause occurs="mustnot">
+		<TermQuery >sumitomo</TermQuery>		
+	</Clause>
+	<Clause occurs="must">
+		<TermQuery>bank</TermQuery>
+	</Clause>
+	<Clause occurs="must">
+		<NumericRangeQuery fieldName="date2" lowerTerm="19870409" upperTerm="19870412"/>
+	</Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/RangeFilterQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/RangeFilterQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/RangeFilterQuery.xml
new file mode 100644
index 0000000..7404f3a
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/RangeFilterQuery.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<FilteredQuery>
+	<Query>
+		<BooleanQuery fieldName="contents">
+			<Clause occurs="should">
+				<TermQuery>merger</TermQuery>
+			</Clause>
+			<Clause occurs="mustnot">
+				<TermQuery >sumitomo</TermQuery>		
+			</Clause>
+			<Clause occurs="must">
+				<TermQuery>bank</TermQuery>
+			</Clause>
+		</BooleanQuery>
+	</Query>
+	
+	<Filter>
+		<RangeFilter fieldName="date" lowerTerm="19870409" upperTerm="19870412"/>
+	</Filter>
+	
+</FilteredQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/SpanQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/SpanQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/SpanQuery.xml
new file mode 100644
index 0000000..6c2df16
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/SpanQuery.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<SpanOr fieldName="contents">
+	<SpanNear slop="8" inOrder="false" >		
+			<SpanOr>
+				<SpanTerm>killed</SpanTerm>
+				<SpanTerm>died</SpanTerm>
+				<SpanTerm>dead</SpanTerm>
+			</SpanOr>
+			<SpanOr>
+				<!-- a less verbose way of declaring SpanTerm declarations - these are analyzed
+					into a series of Tokens which are added as SpanTerm elements of a SpanOr
+				-->
+				<SpanOrTerms>miner miners</SpanOrTerms>
+				<!-- finds mine near worker or workers -->
+				<SpanNear slop="6" inOrder="false">		
+					<SpanTerm>mine</SpanTerm>					
+					<SpanOrTerms>worker workers</SpanOrTerms>
+          <BoostingTermQuery>heavy</BoostingTermQuery>
+        </SpanNear>
+			</SpanOr>
+	</SpanNear>	
+	<SpanFirst end="10">
+		<SpanOrTerms>fire burn</SpanOrTerms>
+	</SpanFirst> 
+	<!-- Other Span examples....
+		
+	<SpanNot>
+		<Include>
+				<SpanNear slop="2" inOrder="2">		
+						<SpanTerm>social</SpanTerm>
+						<SpanTerm>services</SpanTerm>
+				</SpanNear>				
+		</Include>
+		<Exclude>
+				<SpanTerm>public</SpanTerm>
+		</Exclude>
+	</SpanNot>
+		-->
+</SpanOr>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/TermQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TermQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/TermQuery.xml
new file mode 100644
index 0000000..14dae37
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TermQuery.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<TermQuery fieldName="contents">sumitomo</TermQuery>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/TermsFilterQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TermsFilterQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/TermsFilterQuery.xml
new file mode 100644
index 0000000..788de85
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TermsFilterQuery.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<FilteredQuery>
+	<Query>
+		<BooleanQuery fieldName="contents">
+			<Clause occurs="should">
+				<TermQuery>merger</TermQuery>
+			</Clause>
+			<Clause occurs="must">
+				<TermQuery>bank</TermQuery> 
+			</Clause>
+		</BooleanQuery>	
+	</Query>
+	<Filter>
+		<!-- TermsFilter uses an analyzer to tokenize Field text and creates a filter for docs
which 
+			have ANY of the supplied terms. Unlike a RangeFilter this can be used for filtering on

+			multiple terms that are not necessarily in a sequence. An example might be a list of primary
+			keys from a database query result or perhaps a choice of "category" labels picked by the
end 
+			user.
+			As a filter, this is much faster than the equivalent query (a BooleanQuery with many 
+			"should" TermQueries)
+			
+			This example might be just a list of Saturdays ie not a contiguous range of values
+			which can be handled by rangefilter
+		-->
+		<TermsFilter fieldName="date">			
+			19870601 19870608 19870615
+		</TermsFilter> 
+	</Filter>
+	
+</FilteredQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/TermsQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TermsQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/TermsQuery.xml
new file mode 100644
index 0000000..89f36a9
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TermsQuery.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+		<!-- TermsQuery uses an analyzer to tokenize text and creates a BooleanQuery with nested
+			"should" TermQueries for each of the tokens encountered. This can be used for user input
+			which may include content or characters that would otherwise be illegal query syntax when
+			using the standard lucene query parser. Of course the downside is that none of the query

+			operators (AND NOT ~ ^ : etc) will have an effect. For some scenarios queries are
+			not formed by people familiar with Lucene query syntax and they can inadvertently type
illegal
+			query syntax so in these cases this is an appropriate and simple alternative
+		--> 
+<TermsQuery fieldName="contents">sumitomo bank</TermsQuery>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
new file mode 100644
index 0000000..b069048
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
@@ -0,0 +1,279 @@
+´╗┐using Lucene.Net.Analysis;
+using Lucene.Net.Documents;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace Lucene.Net.QueryParsers.Xml
+{
+    /*
+     * 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.
+     */
+
+    public class TestParser : LuceneTestCase
+    {
+        internal const string RESOURCE_PATH = "Lucene.Net.QueryParsers.Xml.";
+
+        private static CoreParser builder;
+        private static Store.Directory dir;
+        private static IndexReader reader;
+        private static IndexSearcher searcher;
+
+        [TestFixtureSetUp]
+        public void BeforeClass()
+        {
+            // TODO: rewrite test (this needs to set QueryParser.enablePositionIncrements,
too, for work with CURRENT):
+            Analyzer analyzer = new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true,
MockTokenFilter.ENGLISH_STOPSET);
+            //initialize the parser
+            builder = new CorePlusExtensionsParser("contents", analyzer);
+
+            TextReader d = new StreamReader(
+            //    typeof(TestParser).getResourceAsStream("reuters21578.txt"), Encoding.ASCII);
+                typeof(TestParser).Assembly.GetManifestResourceStream(RESOURCE_PATH + "reuters21578.txt"),
Encoding.ASCII);
+            dir = NewDirectory();
+            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
analyzer));
+            String line = d.ReadLine();
+            while (line != null)
+            {
+                int endOfDate = line.IndexOf('\t');
+                String date = line.Substring(0, endOfDate).Trim();
+                String content = line.Substring(endOfDate).Trim();
+                Document doc = new Document();
+                doc.Add(NewTextField("date", date, Field.Store.YES));
+                doc.Add(NewTextField("contents", content, Field.Store.YES));
+                doc.Add(new IntField("date2", Convert.ToInt32(date), Field.Store.NO));
+                writer.AddDocument(doc);
+                line = d.ReadLine();
+            }
+            d.Dispose();
+            writer.Dispose();
+            reader = DirectoryReader.Open(dir);
+            searcher = NewSearcher(reader);
+
+        }
+
+        [TestFixtureTearDown]
+        public static void AfterClass()
+        {
+            reader.Dispose();
+            dir.Dispose();
+            reader = null;
+            searcher = null;
+            dir = null;
+            builder = null;
+        }
+
+        [Test]
+        public void TestSimpleXML()
+        {
+            Query q = Parse("TermQuery.xml");
+            DumpResults("TermQuery", q, 5);
+        }
+
+        [Test]
+        public void TestSimpleTermsQueryXML()
+        {
+            Query q = Parse("TermsQuery.xml");
+            DumpResults("TermsQuery", q, 5);
+        }
+
+        [Test]
+        public void TestBooleanQueryXML()
+        {
+            Query q = Parse("BooleanQuery.xml");
+            DumpResults("BooleanQuery", q, 5);
+        }
+
+        [Test]
+        public void TestDisjunctionMaxQueryXML()
+        {
+            Query q = Parse("DisjunctionMaxQuery.xml");
+            assertTrue(q is DisjunctionMaxQuery);
+            DisjunctionMaxQuery d = (DisjunctionMaxQuery)q;
+            assertEquals(0.0f, d.TieBreakerMultiplier, 0.0001f);
+            assertEquals(2, d.Disjuncts.size());
+            DisjunctionMaxQuery ndq = (DisjunctionMaxQuery)d.Disjuncts[1];
+            assertEquals(1.2f, ndq.TieBreakerMultiplier, 0.0001f);
+            assertEquals(1, ndq.Disjuncts.size());
+        }
+
+        [Test]
+        public void TestRangeFilterQueryXML()
+        {
+            Query q = Parse("RangeFilterQuery.xml");
+            DumpResults("RangeFilter", q, 5);
+        }
+
+        [Test]
+        public void TestUserQueryXML()
+        {
+            Query q = Parse("UserInputQuery.xml");
+            DumpResults("UserInput with Filter", q, 5);
+        }
+
+        [Test]
+        public void TestCustomFieldUserQueryXML()
+        {
+            Query q = Parse("UserInputQueryCustomField.xml");
+            int h = searcher.Search(q, null, 1000).TotalHits;
+            assertEquals("UserInputQueryCustomField should produce 0 result ", 0, h);
+        }
+
+        [Test]
+        public void TestLikeThisQueryXML()
+        {
+            Query q = Parse("LikeThisQuery.xml");
+            DumpResults("like this", q, 5);
+        }
+
+        [Test]
+        public void TestBoostingQueryXML()
+        {
+            Query q = Parse("BoostingQuery.xml");
+            DumpResults("boosting ", q, 5);
+        }
+
+        [Test]
+        public void TestFuzzyLikeThisQueryXML()
+        {
+            Query q = Parse("FuzzyLikeThisQuery.xml");
+            //show rewritten fuzzyLikeThisQuery - see what is being matched on
+            if (VERBOSE)
+            {
+                Console.WriteLine(q.Rewrite(reader));
+            }
+            DumpResults("FuzzyLikeThis", q, 5);
+        }
+
+        [Test]
+        public void TestTermsFilterXML()
+        {
+            Query q = Parse("TermsFilterQuery.xml");
+            DumpResults("Terms Filter", q, 5);
+        }
+
+        [Test]
+        public void TestBoostingTermQueryXML()
+        {
+            Query q = Parse("BoostingTermQuery.xml");
+            DumpResults("BoostingTermQuery", q, 5);
+        }
+
+        [Test]
+        public void TestSpanTermXML()
+        {
+            Query q = Parse("SpanQuery.xml");
+            DumpResults("Span Query", q, 5);
+        }
+
+        [Test]
+        public void TestConstantScoreQueryXML()
+        {
+            Query q = Parse("ConstantScoreQuery.xml");
+            DumpResults("ConstantScoreQuery", q, 5);
+        }
+
+        [Test]
+        public void TestMatchAllDocsPlusFilterXML()
+        {
+            Query q = Parse("MatchAllDocsQuery.xml");
+            DumpResults("MatchAllDocsQuery with range filter", q, 5);
+        }
+
+        [Test]
+        public void TestBooleanFilterXML()
+        {
+            Query q = Parse("BooleanFilter.xml");
+            DumpResults("Boolean filter", q, 5);
+        }
+
+        [Test]
+        public void TestNestedBooleanQuery()
+        {
+            Query q = Parse("NestedBooleanQuery.xml");
+            DumpResults("Nested Boolean query", q, 5);
+        }
+
+        [Test]
+        public void TestCachedFilterXML()
+        {
+            Query q = Parse("CachedFilter.xml");
+            DumpResults("Cached filter", q, 5);
+        }
+
+        [Test]
+        public void TestDuplicateFilterQueryXML()
+        {
+            IList<AtomicReaderContext> leaves = searcher.TopReaderContext.Leaves;
+            //AssumeTrue("", leaves.size() == 1); // LUCENENET NOTE: Not sure why this is
here - the test is skipped
+            Query q = Parse("DuplicateFilterQuery.xml");
+            int h = searcher.Search(q, null, 1000).TotalHits;
+            assertEquals("DuplicateFilterQuery should produce 1 result ", 1, h);
+        }
+
+        [Test]
+        public void TestNumericRangeFilterQueryXML()
+        {
+            Query q = Parse("NumericRangeFilterQuery.xml");
+            DumpResults("NumericRangeFilter", q, 5);
+        }
+
+        [Test]
+        public void TestNumericRangeQueryQueryXML()
+        {
+            Query q = Parse("NumericRangeQueryQuery.xml");
+            DumpResults("NumericRangeQuery", q, 5);
+        }
+
+        //================= Helper methods ===================================
+
+        private Query Parse(String xmlFileName)
+        {
+            //Stream xmlStream = typeof(TestParser).getResourceAsStream(xmlFileName);
+            using (Stream xmlStream = typeof(TestParser).Assembly.GetManifestResourceStream(RESOURCE_PATH
+ xmlFileName))
+            { 
+                Query result = builder.Parse(xmlStream);
+                return result;
+            }
+        }
+
+        private void DumpResults(String qType, Query q, int numDocs)
+        {
+            if (VERBOSE)
+            {
+                Console.WriteLine("TEST: query=" + q);
+            }
+            TopDocs hits = searcher.Search(q, null, numDocs);
+            assertTrue(qType + " should produce results ", hits.TotalHits > 0);
+            if (VERBOSE)
+            {
+                Console.WriteLine("=========" + qType + "============");
+                ScoreDoc[] scoreDocs = hits.ScoreDocs;
+                for (int i = 0; i < Math.Min(numDocs, hits.TotalHits); i++)
+                {
+                    Document ldoc = searcher.Doc(scoreDocs[i].Doc);
+                    Console.WriteLine("[" + ldoc.Get("date") + "]" + ldoc.Get("contents"));
+                }
+                Console.WriteLine();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs
new file mode 100644
index 0000000..f94ec70
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs
@@ -0,0 +1,185 @@
+´╗┐using Lucene.Net.Analysis;
+using Lucene.Net.Documents;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Store;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace Lucene.Net.QueryParsers.Xml
+{
+    /*
+     * 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.
+     */
+
+    /// <summary>
+    /// This class illustrates how form input (such as from a web page or Swing gui) can
be
+    /// turned into Lucene queries using a choice of XSL templates for different styles of
queries.
+    /// </summary>
+    public class TestQueryTemplateManager : LuceneTestCase
+    {
+        private CoreParser builder;
+        private Analyzer analyzer;
+        private IndexSearcher searcher;
+        private IndexReader reader;
+        private Directory dir;
+
+        //A collection of documents' field values for use in our tests
+        String[] docFieldValues =
+            {
+                "artist=Jeff Buckley \talbum=Grace \treleaseDate=1999 \tgenre=rock",
+                "artist=Fugazi \talbum=Repeater \treleaseDate=1990 \tgenre=alternative",
+                "artist=Fugazi \talbum=Red Medicine \treleaseDate=1995 \tgenre=alternative",
+                "artist=Peeping Tom \talbum=Peeping Tom \treleaseDate=2006 \tgenre=rock",
+                "artist=Red Snapper \talbum=Prince Blimey \treleaseDate=1996 \tgenre=electronic"
+            };
+
+        //A collection of example queries, consisting of name/value pairs representing form
content plus
+        // a choice of query style template to use in the test, with expected number of hits
+        String[] queryForms =
+            {
+                "artist=Fugazi \texpectedMatches=2 \ttemplate=albumBooleanQuery",
+                "artist=Fugazi \treleaseDate=1990 \texpectedMatches=1 \ttemplate=albumBooleanQuery",
+                "artist=Buckley \tgenre=rock \texpectedMatches=1 \ttemplate=albumFilteredQuery",
+                "artist=Buckley \tgenre=electronic \texpectedMatches=0 \ttemplate=albumFilteredQuery",
+                "queryString=artist:buckly~ NOT genre:electronic \texpectedMatches=1 \ttemplate=albumLuceneClassicQuery"
+            };
+
+        [Test]
+        public void TestFormTransforms()
+        {
+            //// Sun 1.5 suffers from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6240963
+            //if (Constants.JAVA_VENDOR.StartsWith("Sun") && Constants.JAVA_VERSION.StartsWith("1.5"))
{
+            //  String defLang = Locale.getDefault().getLanguage();
+            //  assumeFalse("Sun JRE 1.5 suffers from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6240963
under Turkish locale", defLang.equals("tr") || defLang.equals("az"));
+            //}
+            //Cache all the query templates we will be referring to.
+            QueryTemplateManager qtm = new QueryTemplateManager();
+            Assembly assembly = GetType().Assembly;
+            using (var stream = assembly.GetManifestResourceStream(TestParser.RESOURCE_PATH
+ "albumBooleanQuery.xsl"))
+            {
+                qtm.AddQueryTemplate("albumBooleanQuery", stream);
+            }
+            using (var stream = assembly.GetManifestResourceStream(TestParser.RESOURCE_PATH
+ "albumFilteredQuery.xsl"))
+            {
+                qtm.AddQueryTemplate("albumFilteredQuery", stream);
+            }
+            using (var stream = assembly.GetManifestResourceStream(TestParser.RESOURCE_PATH
+ "albumLuceneClassicQuery.xsl"))
+            {
+                qtm.AddQueryTemplate("albumLuceneClassicQuery", stream);
+            }
+
+            //Run all of our test queries
+            foreach (String queryForm in queryForms)
+            {
+                IDictionary<string, string> queryFormProperties = getPropsFromString(queryForm);
+
+                //Get the required query XSL template for this test
+                //      Templates template=getTemplate(queryFormProperties.getProperty("template"));
+
+                //Transform the queryFormProperties into a Lucene XML query
+                XmlDocument doc = qtm.GetQueryAsDOM(queryFormProperties, queryFormProperties["template"]);
+
+                //Parse the XML query using the XML parser
+                Query q = builder.GetQuery(doc.DocumentElement);
+
+                //Run the query
+                int h = searcher.Search(q, null, 1000).TotalHits;
+
+                //Check we have the expected number of results
+                int expectedHits = int.Parse(queryFormProperties["expectedMatches"]);
+                assertEquals("Number of results should match for query " + queryForm, expectedHits,
h);
+
+            }
+        }
+
+        //Helper method to construct Lucene query forms used in our test
+        IDictionary<string, string> getPropsFromString(String nameValuePairs)
+        {
+            IDictionary<string, string> result = new Dictionary<string, string>();
+            StringTokenizer st = new StringTokenizer(nameValuePairs, "\t=");
+            while (st.HasMoreTokens())
+            {
+                String name = st.NextToken().Trim();
+                if (st.HasMoreTokens())
+                {
+                    String value = st.NextToken().Trim();
+                    result[name] = value;
+                }
+            }
+            return result;
+        }
+
+        //Helper method to construct Lucene documents used in our tests
+        Document getDocumentFromString(String nameValuePairs)
+        {
+            Document result = new Document();
+            StringTokenizer st = new StringTokenizer(nameValuePairs, "\t=");
+            while (st.HasMoreTokens())
+            {
+                String name = st.NextToken().Trim();
+                if (st.HasMoreTokens())
+                {
+                    String value = st.NextToken().Trim();
+                    result.Add(NewTextField(name, value, Field.Store.YES));
+                }
+            }
+            return result;
+        }
+
+        /*
+          * @see TestCase#setUp()
+          */
+
+        public override void SetUp()
+        {
+            base.SetUp();
+
+            analyzer = new MockAnalyzer(Random());
+            //Create an index
+            dir = NewDirectory();
+            IndexWriter w = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
analyzer));
+            foreach (String docFieldValue in docFieldValues)
+            {
+                w.AddDocument(getDocumentFromString(docFieldValue));
+            }
+            w.ForceMerge(1);
+            w.Dispose();
+            reader = DirectoryReader.Open(dir);
+            searcher = NewSearcher(reader);
+
+            //initialize the parser
+            builder = new CorePlusExtensionsParser("artist", analyzer);
+
+        }
+
+
+        public override void TearDown()
+        {
+            reader.Dispose();
+            dir.Dispose();
+            base.TearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQuery.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQuery.xml b/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQuery.xml
new file mode 100644
index 0000000..2a48534
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQuery.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<FilteredQuery>
+	<Query>
+		<UserQuery>"Bank of England"</UserQuery>
+	</Query>
+	<Filter>
+		<RangeFilter fieldName="date" lowerTerm="19870409" upperTerm="19870412"/>
+	</Filter>
+	
+</FilteredQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQueryCustomField.xml
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQueryCustomField.xml b/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQueryCustomField.xml
new file mode 100644
index 0000000..7b35a63
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/UserInputQueryCustomField.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<UserQuery fieldName="doesNotExist" boost="10">Bank^2</UserQuery>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/albumBooleanQuery.xsl
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/albumBooleanQuery.xsl b/src/Lucene.Net.Tests.QueryParser/Xml/albumBooleanQuery.xsl
new file mode 100644
index 0000000..9747952
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/albumBooleanQuery.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/Document">
+<!--This template ANDs all fields together. Within a single field all terms are ORed.
+	The query fields are fed directly through an analyzer and so do not need to adhere to  
+	traditional Lucene query syntax.
+ -->	
+<BooleanQuery>
+	<xsl:if test="count(artist)>0">
+	    <Clause occurs="must">
+	      <TermsQuery fieldName="artist"><xsl:value-of select="artist"/></TermsQuery>
+	   </Clause>
+   </xsl:if>
+	<xsl:if test="count(album)>0">
+	    <Clause occurs="must">
+	      <TermsQuery fieldName="album"><xsl:value-of select="album"/></TermsQuery>
+	   </Clause>
+   </xsl:if>
+	<xsl:if test="count(genre)>0">
+	    <Clause occurs="must">
+	      <TermsQuery fieldName="genre"><xsl:value-of select="genre"/></TermsQuery>
+	   </Clause>
+   </xsl:if>
+	<xsl:if test="count(releaseDate)>0">
+	    <Clause occurs="must">
+	      <TermsQuery fieldName="releaseDate"><xsl:value-of select="releaseDate"/></TermsQuery>
+	   </Clause>
+   </xsl:if>
+</BooleanQuery>
+
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/albumFilteredQuery.xsl
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/albumFilteredQuery.xsl b/src/Lucene.Net.Tests.QueryParser/Xml/albumFilteredQuery.xsl
new file mode 100644
index 0000000..28b7607
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/albumFilteredQuery.xsl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/Document">
+<!-- This template uses an efficient, cached filter for the "genre" field".
+	Other query fields are fed directly through an analyzer and so do not need to adhere to
 
+	traditional Lucene query syntax. Terms within a field are ORed while different fields are
ANDed
+ -->	
+<FilteredQuery>
+	<Query>
+		<BooleanQuery>
+			<xsl:if test="count(artist)>0">
+			    <Clause occurs="must">
+			      <TermsQuery fieldName="artist"><xsl:value-of select="artist"/></TermsQuery>
+			   </Clause>
+		   </xsl:if>
+			<xsl:if test="count(album)>0">
+			    <Clause occurs="must">
+			      <TermsQuery fieldName="album"><xsl:value-of select="album"/></TermsQuery>
+			   </Clause>
+		   </xsl:if>
+			<xsl:if test="count(releaseDate)>0">
+			    <Clause occurs="must">
+			      <TermsQuery fieldName="releaseDate"><xsl:value-of select="releaseDate"/></TermsQuery>
+			   </Clause>
+		   </xsl:if>
+	</BooleanQuery>
+	</Query>
+	<Filter>
+		<CachedFilter>
+			<!-- Example filter to be cached for fast, repeated use -->
+			<TermsFilter fieldName="genre">			
+				<xsl:value-of select="genre"/>
+			</TermsFilter>
+		</CachedFilter>		
+	</Filter>	
+</FilteredQuery>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2ae0b1bb/src/Lucene.Net.Tests.QueryParser/Xml/albumLuceneClassicQuery.xsl
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/albumLuceneClassicQuery.xsl b/src/Lucene.Net.Tests.QueryParser/Xml/albumLuceneClassicQuery.xsl
new file mode 100644
index 0000000..65fe1a8
--- /dev/null
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/albumLuceneClassicQuery.xsl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/Document">
+<!-- This template is designed to work with a google-like search form - one edit box and

+	uses the traditional Lucene query syntax
+ -->		
+<BooleanQuery>
+    <Clause occurs="must">
+	      <UserQuery><xsl:value-of select="queryString"/></UserQuery>
+   </Clause>
+</BooleanQuery>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file


Mime
View raw message