lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 02/02: BREAKING: Lucene.Net.QueryParser.Flexible.Core.Nodes.IQueryNode: Added TryGetTag() method to simplify looking up a tag by name.
Date Sat, 24 Jul 2021 19:13:37 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 15549f854df8ed750cd258c2c3d9b303c473763e
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Sat Jul 24 05:24:58 2021 +0700

    BREAKING: Lucene.Net.QueryParser.Flexible.Core.Nodes.IQueryNode: Added TryGetTag() method
to simplify looking up a tag by name.
---
 src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNode.cs     | 5 +++++
 src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNode.cs
index 4ea4544..15c851b 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNode.cs
@@ -57,6 +57,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
         /// </summary>
         object GetTag(string tagName);
 
+        /// <summary>
+        /// Gets the tag associated with the specified tagName.
+        /// </summary>
+        bool TryGetTag(string tagName, out object tag);
+
         IQueryNode Parent { get; }
 
         /// <summary>
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs
index 3be4de4..426b0dd 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs
@@ -181,7 +181,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
             return this.tags[CultureInfo.InvariantCulture.TextInfo.ToLower(tagName)];
         }
 
-        // LUCENENET TODO: API - Create TryGetTag method to combine the above 2 operations
+        /// <inheritdoc/>
+        public virtual bool TryGetTag(string tagName, out object tag)
+        {
+            return this.tags.TryGetValue(tagName, out tag);
+        }
 
         private IQueryNode parent = null;
 

Mime
View raw message