lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NightOwl888 <...@git.apache.org>
Subject [GitHub] lucenenet pull request #175: IndexableField API Consistency Fix
Date Thu, 28 Jul 2016 18:13:45 GMT
GitHub user NightOwl888 opened a pull request:

    https://github.com/apache/lucenenet/pull/175

    IndexableField API Consistency Fix

    Made `Name()`, `FieldType()`, `GetBoost()` and `BinaryValue()` into property getters for
consistency with the other getters in the `IndexableField` type. So we have all properties
instead of a mixed bag of properties and methods. For example...
    
    ```c#
    public SerializableField(IndexableField field)
    {
    	name = field.Name();
    	if (field.NumericValue != null)
    	{
    		fieldsData = field.NumericValue;
    	}
    	else if (field.StringValue != null)
    	{
    		fieldsData = field.StringValue;
    	}
    	else if (field.BinaryValue() != null)
    	{
    		fieldsData = field.BinaryValue().Bytes;
    	}
    	else
    	{
    		throw new NotSupportedException("Doesn't support this field type so far");
    	}
    }
    ```
    
    now looks like...
    
    ```c#
    public SerializableField(IndexableField field)
    {
    	name = field.Name;
    	if (field.NumericValue != null)
    	{
    		fieldsData = field.NumericValue;
    	}
    	else if (field.StringValue != null)
    	{
    		fieldsData = field.StringValue;
    	}
    	else if (field.BinaryValue != null)
    	{
    		fieldsData = field.BinaryValue.Bytes;
    	}
    	else
    	{
    		throw new NotSupportedException("Doesn't support this field type so far");
    	}
    }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/NightOwl888/lucenenet lucenenet-indexablefield-api

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucenenet/pull/175.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #175
    
----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message