lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [Lucene.Net] svn commit: r1204404 - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/contrib/FastVectorHighlighter/ test/contrib/FastVectorHighlighter/
Date Mon, 21 Nov 2011 08:57:30 GMT
Author: ccurrens
Date: Mon Nov 21 08:57:30 2011
New Revision: 1204404

URL: http://svn.apache.org/viewvc?rev=1204404&view=rev
Log:
Ported changes to FastVectorHighlighter

Modified:
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldQuery.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldTermStack.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/AbstractTestCase.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/IndexTimeSynonymTest.cs

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldQuery.cs?rev=1204404&r1=1204403&r2=1204404&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldQuery.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldQuery.cs
Mon Nov 21 08:57:30 2011
@@ -78,10 +78,8 @@ namespace Lucene.Net.Search.Vectorhighli
             else if (sourceQuery is DisjunctionMaxQuery)
             {
                 DisjunctionMaxQuery dmq = (DisjunctionMaxQuery)sourceQuery;
-                System.Collections.IEnumerator en = dmq.Iterator();
-                while (en.MoveNext())
+                foreach(Query query in dmq)
                 {
-                    Query query = (Query)en.Current;
                     flatten(query, flatQueries);
                 }
             }

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldTermStack.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldTermStack.cs?rev=1204404&r1=1204403&r2=1204404&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldTermStack.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/FastVectorHighlighter/FieldTermStack.cs
Mon Nov 21 08:57:30 2011
@@ -42,7 +42,7 @@ namespace Lucene.Net.Search.Vectorhighli
         public static void Main(String[] args)
         {
             Analyzer analyzer = new WhitespaceAnalyzer();
-            QueryParser parser = new QueryParser("f", analyzer);
+            QueryParser parser = new QueryParser(Util.Version.LUCENE_CURRENT, "f", analyzer);
             Query query = parser.Parse("a x:b");
             FieldQuery fieldQuery = new FieldQuery(query, true, false);
 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/AbstractTestCase.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/AbstractTestCase.cs?rev=1204404&r1=1204403&r2=1204404&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/AbstractTestCase.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/AbstractTestCase.cs
Mon Nov 21 08:57:30 2011
@@ -77,8 +77,8 @@ namespace Lucene.Net.Search.Vectorhighli
             analyzerW = new WhitespaceAnalyzer();
             analyzerB = new BigramAnalyzer();
             analyzerK = new KeywordAnalyzer();
-            paW = new QueryParser(F, analyzerW);
-            paB = new QueryParser(F, analyzerB);
+            paW = new QueryParser(Util.Version.LUCENE_CURRENT, F, analyzerW);
+            paB = new QueryParser(Util.Version.LUCENE_CURRENT, F, analyzerB);
             dir = new RAMDirectory();
         }
 
@@ -238,8 +238,8 @@ namespace Lucene.Net.Search.Vectorhighli
 
             void Init()
             {
-                termAtt = (TermAttribute)AddAttribute(typeof(TermAttribute));
-                offsetAtt = (OffsetAttribute)AddAttribute(typeof(OffsetAttribute));
+                termAtt = AddAttribute<TermAttribute>();
+                offsetAtt = AddAttribute<OffsetAttribute>();
             }
 
             TermAttribute termAtt = null;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/IndexTimeSynonymTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/IndexTimeSynonymTest.cs?rev=1204404&r1=1204403&r2=1204404&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/IndexTimeSynonymTest.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/FastVectorHighlighter/IndexTimeSynonymTest.cs
Mon Nov 21 08:57:30 2011
@@ -345,31 +345,28 @@ namespace Lucene.Net.Search.Vectorhighli
 
             public override TokenStream TokenStream(String fieldName, System.IO.TextReader
reader)
             {
-                Token reusableToken = new Token();
-
-                Lucene.Net.Analysis.TokenStream.SetOnlyUseNewAPI(true);
-                TokenStream ts = new AnonymousTokenStream(this, reusableToken);
-
-                ts.AddAttributeImpl(reusableToken);
+                TokenStream ts = new AnonymousTokenStream(this);
                 return ts;
             }
 
             class AnonymousTokenStream : TokenStream
             {
+                private AttributeImpl reusableToken;
                 TokenArrayAnalyzer parent = null;
-                Token reusableToken = null;
 
-                public AnonymousTokenStream(TokenArrayAnalyzer parent,Token reusableToken)
+                public AnonymousTokenStream(TokenArrayAnalyzer parent)
+                    : base(Token.TOKEN_ATTRIBUTE_FACTORY)
                 {
                     this.parent = parent;
-                    this.reusableToken = reusableToken;
+                    this.reusableToken = (AttributeImpl)AddAttribute<TermAttribute>();
                 }
 
                 int p = 0;
                 public override bool IncrementToken()
                 {
                     if (p >= parent.tokens.Length) return false;
-                    parent.tokens[p++].CopyTo(reusableToken);
+                    ClearAttributes();
+                    parent.tokens[p++].CopyTo(this.reusableToken);
                     return true;
                 }
             }



Mime
View raw message