gephi/gephi-plugins — Issue #7: Degree equals filters do not work properly
Author: luizribeiro
Created: 2012-02-18 04:17:03+00:00
State: open
Labels: python-scripting-plugin

The following command does not work properly:

```python
visible = g.filter(degree == 10)
```

This can be either a misunderstanding of the Filters API from my end or a problem in the API's implementation itself. The current version of the code builds a filter that matches the degree range [0, 10].

There's a ``FIXME`` annotation on the [code section that handles these filters](https://github.com/gephi/gephi-plugins/blob/python-scripting-plugin/ScriptingAPI/src/org/gephi/scripting/wrappers/GyAttributeTopology.java#L135). This section is really straightforward and just builds the ``Range`` object with the same value on the upper and lower bounds as follows:

```java
protected Query buildEqualsQuery(PyObject match) {
Integer intMatch = (Integer) match.__tojava__(Integer.class);
return buildRangeQuery(new Range(intMatch, intMatch, Integer.MIN_VALUE, Integer.MAX_VALUE));
}
```