Fixed spans with attribute query, for excluding only not-attribute, without any attribute.
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
index 94f3590..9287a4d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
@@ -87,19 +87,21 @@
 	private boolean advance() throws IOException {
 		
 		while (hasMoreSpans && computeElementPosition()){			
-		 	    logger.info("element: " + withAttributeSpans.start() + ","+ withAttributeSpans.end() +
-					" ref:"+withAttributeSpans.getSpanId());
+		 	    //logger.info("element: " + withAttributeSpans.start() + ","+ withAttributeSpans.end() +
+				//	" ref:"+withAttributeSpans.getSpanId());
 			
 			if (checkElementRef() && checkNotElementRef()){			
 				this.matchDocNumber = withAttributeSpans.doc();
 				this.matchStartPosition = withAttributeSpans.start();
 				this.matchEndPosition = withAttributeSpans.end();
 				this.matchPayload = withAttributeSpans.getPayload();
-				hasMoreSpans = attributeList.get(0).next();
 				
-			    logger.info("MATCH "+matchDocNumber);
+				if (attributeList.size() > 0)
+					hasMoreSpans = attributeList.get(0).next();
 				
-				hasMoreSpans = withAttributeSpans.next();		
+			    //logger.info("MATCH "+matchDocNumber);
+				
+				hasMoreSpans &= withAttributeSpans.next();		
 				return true;
 			}
 		}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
index cccbd23..74483b3 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
@@ -259,10 +259,10 @@
 		// child-of relations
 		SpanRelationQuery srq = new SpanRelationQuery(
 				new SpanTermQuery(new Term("base",">:child-of")),true);
-		/*kr = ki.search(srq,(short) 20);
+		kr = ki.search(srq,(short) 20);
 		
 		assertEquals(13, kr.getTotalResults());
-		*/
+		
 		// child-of with attr func=sbj
 		SpanWithAttributeQuery wq = 
 			new SpanWithAttributeQuery(srq, 
@@ -277,6 +277,23 @@
 		assertEquals(0,kr.getMatch(0).getStartPos()); // token
 		assertEquals(1,kr.getMatch(0).getEndPos());
 		
+		// child-of without attr func=sbj
+		wq = 
+			new SpanWithAttributeQuery(srq, 
+				new SpanAttributeQuery( 
+					new SpanTermQuery(new Term("base", "r@:func=sbj")),
+					true, true), 
+				true
+		);
+		kr = ki.search(wq,(short) 20);
+		assertEquals(12, kr.getTotalResults());
+		
+		/*for (KorapMatch km : kr.getMatches()){		
+			System.out.println(km.getStartPos() +","+km.getEndPos()
+			//	+" "+km.getSnippetBrackets()
+			);
+		}*/		
+		
 		// child-of with attr func-obj
 		wq = new SpanWithAttributeQuery(srq, 
 				new SpanAttributeQuery( 
@@ -314,10 +331,7 @@
 		assertEquals(6,kr.getMatch(1).getStartPos());
 		assertEquals(7,kr.getMatch(1).getEndPos());
 		
-		/*for (KorapMatch km : kr.getMatches()){		
-			System.out.println(km.getStartPos() +","+km.getEndPos()+" "
-    			+km.getSnippetBrackets());
-		}	*/	
+		
 	}
 	
 	/** Relation with variable