Project

General

Profile

« Previous | Next » 

Revision c4f7a205

Added by Katja Luther over 7 years ago

fix #6296: fix problems for simple search

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java
1486 1486
                " left join rt.name as n2" +
1487 1487
                " left join rft.type as rtype";
1488 1488

  
1489
           String doCommonNamesJoin =   "join t.descriptions d "+
1490
                   "join d.descriptionElements e " +
1491
                   "join e.feature f ";
1489
           String doCommonNamesJoin =   "join t.descriptions as description "+
1490
                   "left join description.descriptionElements as com " +
1491
                   "left join com.feature f ";
1492 1492

  
1493 1493

  
1494 1494
           String doClassificationWhere = " tn.classification = :classification";
1495 1495
           String doClassificationForMisappliedNamesWhere = " tn2 .classification = :classification";
1496 1496

  
1497 1497
           String doAreaRestrictionWhere =  " e.area.uuid in (:namedAreasUuids)";
1498
           String doCommonNamesRestrictionWhere = " f.supportsCommonTaxonName = true and e.name "+matchMode.getMatchOperator()+" :queryString";
1498
           String doCommonNamesRestrictionWhere = " (f.supportsCommonTaxonName = true and com.name "+matchMode.getMatchOperator()+" :queryString )";
1499 1499

  
1500 1500
           String doSearchFieldWhere = "%s." + searchField +  " " + matchMode.getMatchOperator() + " :queryString";
1501 1501

  
......
1529 1529
                    " WHERE " + doClassificationWhere +
1530 1530
                    " AND " + String.format(doSearchFieldWhere, "sn");
1531 1531
                    commonNameSubselect =String.format(doTaxonSubSelect, "t" )+ doCommonNamesJoin +
1532
                            " WHERE "+ doAreaRestrictionWhere +
1533
                             " AND " + doClassificationWhere +
1532
                            " WHERE " + doClassificationWhere +
1534 1533
                            " AND " + doCommonNamesRestrictionWhere;
1535 1534
                }
1536 1535
            }else{ //misappliedNames included
......
1585 1584
                synonymSubselect = String.format(doAreaRestrictionSubSelect, "s") + doSynonymNameJoin +
1586 1585
                " WHERE " +   doAreaRestrictionWhere +
1587 1586
                " AND " +  String.format(doSearchFieldWhere, "sn");
1588
                commonNameSubselect = String.format(doTaxonSubSelect, "t")+ doCommonNamesJoin +
1587
                commonNameSubselect = String.format(doAreaRestrictionSubSelect, "t")+ doCommonNamesJoin +
1589 1588
                        " WHERE " + doAreaRestrictionWhere +
1590 1589
                        " AND " + doCommonNamesRestrictionWhere;
1591 1590

  

Also available in: Unified diff