Skip to content

Commit

Permalink
[DROOLS-105] Indexing may be broken with unification queries
Browse files Browse the repository at this point in the history
  • Loading branch information
sotty committed Apr 30, 2013
1 parent 647adc7 commit 152843a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Expand Up @@ -3207,22 +3207,24 @@ public void isAWithBackChaining( TraitFactory.VirtualPropertyMode mode ) {
StatefulKnowledgeSession ksession = getSession( source );
TraitFactory.setMode( mode, ksession.getKnowledgeBase() );

List list = new ArrayList();
ksession.setGlobal( "list", list );

ksession.fireAllRules();

ksession.insert( "Como" );

ksession.fireAllRules();

assertTrue( list.contains( "Italy" ) );
}

@Test
@Ignore
public void isAWithBackChainingTriples() {
isAWithBackChaining( TraitFactory.VirtualPropertyMode.TRIPLES );
}

@Test
@Ignore
public void isAWithBackChainingMap() {
isAWithBackChaining( TraitFactory.VirtualPropertyMode.MAP );
}
Expand Down
Expand Up @@ -3267,7 +3267,6 @@ public void testQueryWithClassLiterals() throws Exception {


@Test
@Ignore
public void testQueryIndexingWithUnification() throws Exception {
String str = "" +
"package org.drools.test \n" +
Expand Down
Expand Up @@ -73,9 +73,10 @@ when

is_in( $p, Country.class, $q ; )

$q := Country( name == "Italy" )
$q := Country( $name : name == "Italy" )
then
System.out.println( "Checking " + $p + " in " + $q );
list.add( $name );
end


Expand Down
Expand Up @@ -334,7 +334,7 @@ private void init(IndexPrecedenceOption indexPrecedenceOption, int keyDepth, sho

// look for other EQUAL constraint to eventually add them to the index
for (int i = firstIndexableConstraint+1; i < constraints.length && indexList.size() < keyDepth; i++) {
if ( ConstraintType.getType(constraints[i]) == ConstraintType.EQUAL) {
if ( ConstraintType.getType(constraints[i]) == ConstraintType.EQUAL && ! ((IndexableConstraint) constraints[i]).isUnification() ) {
indexList.add(((IndexableConstraint)constraints[i]).getFieldIndex());
}
}
Expand Down

0 comments on commit 152843a

Please sign in to comment.