From: <ssk...@vh...> - 2005-11-30 12:07:39
|
Author: sskracic Date: 2005-11-30 13:05:40 +0100 (Wed, 30 Nov 2005) New Revision: 1016 Modified: trunk/ccm-cms/src/com/arsdigita/cms/search/IntermediaQueryEngine.java Log: Integrated sourceforge patch [ 1368140 ] Search all items - not just cms. Modified: trunk/ccm-cms/src/com/arsdigita/cms/search/IntermediaQueryEngine.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/search/IntermediaQueryEngine.java 2005-11-30 11:18:57 UTC (rev 1015) +++ trunk/ccm-cms/src/com/arsdigita/cms/search/IntermediaQueryEngine.java 2005-11-30 12:05:40 UTC (rev 1016) @@ -51,19 +51,21 @@ addColumn("audited.modifying_user", "modifying_user"); addColumn("audited.creation_date", "creation_date"); addColumn("audited.creation_user", "creation_user"); - addTable("cms_items", "i"); // XXX: I am going to hell for the line below. I console myself only // because this is a hack to work around a terrible interface. // This line replaces the existing hash entry for 'search_content' and // abuses the alias to add a left outer join. // mb...@re... 02/02/2005 - addTable( "search_content", "c left outer join cms_pages p on ( p.item_id = c.object_id )" ); - - addTable("acs_auditing", "audited"); - addCondition("c.object_id = i.item_id"); - //addCondition("c.object_id = p.item_id"); - addCondition("c.object_id = audited.object_id"); + // + // amended to include (other) outer joins, otherwise you + // can't search for anything other than cms items + // cg - 11/10/2005 + // + // likewise going to hell. Seb - 30/11/2005 + addTable( "search_content", "c left outer join cms_pages p on ( p.item_id = c.object_id )" + + " left outer join cms_items i on (c.object_id = i.item_id )" + + " left outer join acs_auditing audited on (c.object_id = audited.object_id)" ); } protected void addFilter(DataQuery query, @@ -71,7 +73,7 @@ super.addFilter(query, filter); FilterType type = filter.getType(); - + if (ContentTypeFilterType.KEY.equals(type.getKey())) { addContentTypeFilter(query, (ContentTypeFilterSpecification)filter); } else if (VersionFilterType.KEY.equals(type.getKey())) { @@ -96,7 +98,7 @@ protected void addVersionFilter(DataQuery query, VersionFilterSpecification filter) { - Filter f = query.addFilter("version = :version"); + Filter f = query.addFilter("nvl(version,'" + filter.getVersion() + "') = :version"); f.set("version", filter.getVersion()); } @@ -124,14 +126,14 @@ String columnName) { Date start = filter.getStartDate(); Date end = filter.getEndDate(); - // XXX The query should actually be the commented out code at the + // XXX The query should actually be the commented out code at the // bottom of this method instead of the query that we are using // we have to comment it out because of a bug with persistence DateFormat format = new SimpleDateFormat("MM/dd/yyyy"); if (start != null) { - Filter f = query.addFilter(columnName + " >= :" + + Filter f = query.addFilter(columnName + " >= :" + columnName + "StartDate"); // we truncate the value using java because we cannot do it // using sql because of the persistence bug @@ -152,7 +154,7 @@ f.set(columnName + "StartDate", startCal.getTime()); } if (end != null) { - Filter f = query.addFilter(columnName + " < :" + + Filter f = query.addFilter(columnName + " < :" + columnName + "EndDate"); // we truncate the value using java because we cannot do it // using sql because of the persistence bug @@ -169,13 +171,13 @@ if (start != null) { // XXX persistence bug - can't deal with functions on fields - Filter f = query.addFilter("trunc(" + columnName + ") >= to_date('" + + Filter f = query.addFilter("trunc(" + columnName + ") >= to_date('" + format.format(start) + - "','MM/DD/YYYY')"); + "','MM/DD/YYYY')"); } if (end != null) { // XXX persistence bug - can't deal with functions on fields - Filter f = query.addFilter("trunc(" + columnName + ") <= to_date('" + + Filter f = query.addFilter("trunc(" + columnName + ") <= to_date('" + format.format(end) + "','MM/DD/YYYY')"); } @@ -198,7 +200,7 @@ // no parties match so we make sure to return no results query.addFilter("1=2"); } else { - Filter f = query.addFilter(columnName + " in :" + + Filter f = query.addFilter(columnName + " in :" + columnName + "parties"); f.set(columnName + "parties", partyIDs); } @@ -234,7 +236,7 @@ "object_id", "id", "com.arsdigita.cms.searchCategoryItems"); - + f.set("ids", ids); } } |