Skip to content

Commit 39a66ac

Browse files
committed
cleanup build and force rebuild of index after creating
1 parent 3f90392 commit 39a66ac

5 files changed

Lines changed: 39 additions & 31 deletions

File tree

schema/src/buildCWMS_DB.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,13 @@ begin
402402
end;
403403
/
404404

405-
@@cwms/oracle_text/setup_indexes.sql
405+
prompt Rebuilding all disabled function-based indexes...
406+
begin
407+
for rec in (select index_name from all_indexes where owner = '&cwms_schema' and funcidx_status = 'DISABLED') loop
408+
execute immediate 'alter index &cwms_schema..'||rec.index_name||' rebuild';
409+
end loop;
410+
end;
411+
/
406412

407413
----------------------------------------------------------------------------------------------------------------------------
408414
-- I hate having this here, but for some reason this SAYS it works when in AT_SCHEMA, but the constraint is missing after --
@@ -416,6 +422,8 @@ exception
416422
end;
417423
/
418424

425+
426+
@@cwms/oracle_text/setup_indexes.sql
419427
--
420428
-- all done
421429
--

schema/src/cwms/cwms_loc_pkg.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3221,7 +3221,7 @@ AS
32213221
*/
32223222
procedure build_search_doc(
32233223
p_rowid in rowid,
3224-
p_doc out clob
3224+
p_doc out varchar2
32253225
);
32263226
END cwms_loc;
32273227
/

schema/src/cwms/cwms_loc_pkg_body.sql

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11058,36 +11058,36 @@ end unassign_loc_groups;
1105811058

1105911059
procedure build_search_doc(
1106011060
p_rowid in rowid,
11061-
p_doc out clob
11061+
p_doc out varchar2
1106211062
)
11063-
is
11063+
is
1106411064
begin
11065-
select
11066-
coalesce(b.base_location_id,'') || ' '
11067-
|| coalesce(pl.sub_location_id,'') || ' '
11068-
|| case
11069-
when pl.sub_location_id is not null
11070-
then b.base_location_id || '-' || pl.sub_location_id || ' '
11071-
else ''
11072-
end
11073-
|| coalesce(pl.public_name,'') || ' '
11074-
|| coalesce(pl.long_name,'') || ' '
11075-
|| coalesce(pl.description,'') || ' '
11076-
|| coalesce(pl.map_label,'') || ' '
11077-
|| coalesce(pl.nearest_city,'') || ' '
11078-
|| coalesce(k.location_kind_id,'') || ' '
11079-
|| coalesce(pl.location_type,'')
11065+
select max(
11066+
coalesce(b.base_location_id,'') || ' '
11067+
|| coalesce(pl.sub_location_id,'') || ' '
11068+
|| case
11069+
when pl.sub_location_id is not null
11070+
then b.base_location_id || '-' || pl.sub_location_id || ' '
11071+
else ''
11072+
end
11073+
|| coalesce(pl.public_name,'') || ' '
11074+
|| coalesce(pl.long_name,'') || ' '
11075+
|| coalesce(pl.description,'') || ' '
11076+
|| coalesce(pl.map_label,'') || ' '
11077+
|| coalesce(pl.nearest_city,'') || ' '
11078+
|| coalesce(k.location_kind_id,'') || ' '
11079+
|| coalesce(pl.location_type,'')
11080+
)
1108011081
into p_doc
1108111082
from at_physical_location pl
11082-
join at_base_location b
11083-
on b.base_location_code = pl.base_location_code
11084-
join cwms_location_kind k
11085-
on k.location_kind_code = pl.location_kind
11083+
left join at_base_location b
11084+
on b.base_location_code = pl.base_location_code
11085+
left join cwms_location_kind k
11086+
on k.location_kind_code = pl.location_kind
1108611087
where pl.rowid = p_rowid;
1108711088

11088-
exception
11089-
when others then
11090-
p_doc := null;
11089+
p_doc := coalesce(p_doc, '');
11090+
1109111091
end build_search_doc;
1109211092

1109311093
begin

schema/src/cwms/oracle_text/setup_indexes.sql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ create index at_physical_location_search_idx
3636
sync (on commit)');
3737
/
3838

39-
prompt Rebuilding all disabled function-based indexes...
4039
alter index CWMS_20.AT_PHYSICAL_LOCATION_SEARCH_IDX rebuild;
40+
4141
begin
42-
for rec in (select index_name from all_indexes where owner = '&cwms_schema' and funcidx_status = 'DISABLED') loop
43-
execute immediate 'alter index &cwms_schema..'||rec.index_name||' rebuild';
44-
end loop;
42+
ctx_ddl.sync_index('AT_PHYSICAL_LOCATION_SEARCH_IDX');
4543
end;
46-
/
44+
/

schema/src/test/test_cwms_loc.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,6 +2774,7 @@ AS
27742774
into l_count
27752775
from av_loc
27762776
where contains(search_doc, 'Van Buren') > 0
2777+
and unit_system = 'SI'
27772778
and location_id = l_loc_id;
27782779

27792780
ut.expect(l_count).to_equal(1);
@@ -2810,6 +2811,7 @@ AS
28102811
into l_count
28112812
from av_loc2
28122813
where contains(search_doc, 'VanBuren') > 0
2814+
and unit_system = 'SI'
28132815
and location_id = l_loc_id;
28142816

28152817
ut.expect(l_count).to_equal(1);

0 commit comments

Comments
 (0)