Browse Source

Überarbeitung der Suchfunktion

master
Imo John 2 weeks ago
parent
commit
b64d25b973
  1. 16
      src-modules/module/kb/masken/29060_felderinfo.unl
  2. 2
      src-modules/module/kb/masken/29060_masken_felder_bez.unl
  3. 173
      src-modules/module/kb/masken/29060_maskeninfo.unl

16
src-modules/module/kb/masken/29060_felderinfo.unl

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
29066^Ticket^60^0^0^100^60^1^char^30^0^999^^^^
29062^Thema^20^0^0^100^200^1^integer^30^0^1^<<SQL>> select id, defaulttext from kb_topic order by 2;^^^
29065^Schlüsselwort^50^0^0^100^200^1^integer^30^0^1^<<SQL>> select id,defaulttext from kb_keyword order by 2;^^^
29060^Sachgebiet^1^0^0^100^200^1^integer^30^0^1^<<SQL>> select tid, name from sachgebiete order by 2;^^^
29064^Eingereicht von^40^0^0^100^200^1^integer^30^0^999^<<SQL>> select tid,name from userinfo where tid in (select distinct submitted_by from kb_chunk) order by 2;^^^
29061^Komponente^10^0^0^100^200^1^integer^30^0^1^<<SQL>> select tid, name from systeminfo order by 2;^^^
29067^Meldungsart^25^0^0^100^200^1^integer^30^0^1^<<SQL>> select id, defaulttext from kb_k_submission_type order by 2;^^<<SQL>> select id, defaulttext from kb_k_submission_type where hiskey_id='Q'^
29063^Stichwort^30^0^0^100^150^1^sql^30^0^0^^^^
29060^Sachgebiet^1^0^0^100^200^1^integer^30^0^1^<<SQL>> select tid, name from sachgebiete order by 2;^ ^ ^
29061^Komponente^10^0^0^100^200^1^integer^30^0^1^<<SQL>> select tid, name from systeminfo order by 2;^ ^ ^
29062^Thema^20^0^0^100^200^1^integer^30^0^1^<<SQL>> select id, defaulttext from kb_topic order by 2;^ ^ ^
29063^Stichwort^30^0^0^100^150^1^sql^255^0^0^^ ^ ^
29064^Eingereicht von^40^0^0^100^200^1^integer^30^0^999^<<SQL>> select tid,name from userinfo where tid in (select distinct submitted_by from kb_chunk) order by 2;^ ^ ^
29065^Schlüsselwort^50^0^0^100^200^1^integer^30^0^1^<<SQL>> select id,defaulttext from kb_keyword order by 2;^ ^ ^
29066^Ticket^60^0^0^100^60^1^char^30^0^999^^ ^ ^
29067^Meldungsart^25^0^0^100^200^1^integer^30^0^1^<<SQL>> select id, defaulttext from kb_k_submission_type order by 2;^ ^<<SQL>> select id, defaulttext from kb_k_submission_type where hiskey_id='Q'^

2
src-modules/module/kb/masken/29060_masken_felder_bez.unl

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
29060^29067^
29060^29060^
29060^29061^
29060^29062^
@ -6,3 +5,4 @@ @@ -6,3 +5,4 @@
29060^29064^
29060^29065^
29060^29066^
29060^29067^

173
src-modules/module/kb/masken/29060_maskeninfo.unl

@ -5,47 +5,163 @@ @@ -5,47 +5,163 @@
<sqlvar name="kb_chunk_anz">\
select count(*) from kb_chunk;\
</sqlvar>\
\
<sqlvar name="split_search" type="hashsequence">\
select unnest(string_to_array('${Stichwort}', ' ')) as part;\
\
</sqlvar>\
</sqlvars>\
<@selectintotmp \
select="1::smallint as ord,C.id,K.hiskey_id as submission_type,K.defaulttext as submission_type_str, C.defaulttext,C.info_text,'../edit/kb/kb_chunk_view_detail.jsp|id=' || C.id as nextedit0,'../edit/kb/kb_chunk_edit.jsp|id=' || C.id as nextedit1,''::varchar(255) as nextedit2,''::varchar(255) as nextedit3"\
source="kb_chunk C left outer join kb_k_submission_type K on (C.submission_type=K.id)"\
target="tmp_k_chunk">\
where 1=1\
/* and C.sachgebiete_id=<<Sachgebiet>> */\
/* and C.systeminfo_id=<<Komponente>> */\
/* and C.submission_type=<<Meldungsart>> */ \
and (1=1 \
/* and (1!=1 or (lower(C.defaulttext) like lower('%<<Stichwort>>%')) */\
/* or (lower(C.longtext) like lower('%<<Stichwort>>%')) */\
/* or (lower(C.info_text) like lower('%<<Stichwort>>%'))) */\
)\
/* and C.submitted_by=<<Eingereicht von>> */\
/* and C.id in (select K.kb_chunk_id from kb_chunk2keyword K where K.kb_keyword_id=<<Schlüsselwort>>) */\
/* and C.id in (select K.kb_chunk_id from kb_chunk2ticket K where K.ticket_id = <<Ticket>>) */\
</@selectintotmp>\
<@informixnolog/>;\
\
-- create table tmp_k_chunk;\
-- Schleife über split_search\
-- bei jedem treffer select 1 as count\
-- Zähle Datensätze in tmp_k_chunk, gruppiere nach id\
--> Ausgabe nach meisten Treffern\
\
create table tmp_k_chunk(\
id integer,\
submission_type varchar(255),\
submission_type_str varchar(255),\
defaulttext text,\
info_text text,\
nextedit0 varchar(255),\
nextedit1 varchar(255),\
nextedit2 varchar(255),\
nextedit3 varchar(255),\
score integer\
);\
\
<#assign count1=0>\
<#list split_search as p>\
<#assign count1=count1+1>\
<#assign count2=1>\
\
<#list split_search as p2>\
<#if (p2?index + 1) < split_search?size>\
<#assign count2=count2+1>\
\
<#if count1!=count2>\
insert into tmp_k_chunk\
select \
C.id,\
K.hiskey_id as submission_type,\
K.defaulttext as submission_type_str, \
C.defaulttext,\
C.info_text,\
'../edit/kb/kb_chunk_view_detail.jsp|id=' || C.id as nextedit0,\
'../edit/kb/kb_chunk_edit.jsp|id=' || C.id as nextedit1,\
''::varchar(255) as nextedit2,\
''::varchar(255) as nextedit3,\
${count2}-${count1}+1 as score\
from \
kb_chunk C \
left outer join kb_k_submission_type K \
on (C.submission_type=K.id)\
where 1=1\
/* and C.sachgebiete_id=<<Sachgebiet>> */\
/* and C.systeminfo_id=<<Komponente>> */\
/* and C.submission_type=<<Meldungsart>> */ \
and (1=1 \
/* and (1!=1 --<<Stichwort>> */\
or (lower(C.defaulttext) like lower('%' || array_to_string((string_to_array('<<Stichwort>>', ' '))[${count1}:${count2}], ' ') ||'%')) --<<Stichwort>> \
or (lower(C.longtext) like lower('%' || array_to_string((string_to_array('<<Stichwort>>', ' '))[${count1}:${count2}], ' ') ||'%')) --<<Stichwort>> \
or (lower(C.info_text) like lower('%' || array_to_string((string_to_array('<<Stichwort>>', ' '))[${count1}:${count2}], ' ') ||'%')) --<<Stichwort>> \
/* ) --<<Stichwort>> */\
)\
/* and C.submitted_by=<<Eingereicht von>> */\
/* and C.id in (select K.kb_chunk_id from kb_chunk2keyword K where K.kb_keyword_id=<<Schlüsselwort>>) */\
/* and C.id in (select K.kb_chunk_id from kb_chunk2ticket K where K.ticket_id = <<Ticket>>) */\
;\
</#if>\
</#if>\
</#list>\
</#list>\
\
<#foreach p in split_search>\
insert into tmp_k_chunk\
select \
C.id,\
K.hiskey_id as submission_type,\
K.defaulttext as submission_type_str, \
C.defaulttext,\
C.info_text,\
'../edit/kb/kb_chunk_view_detail.jsp|id=' || C.id as nextedit0,\
'../edit/kb/kb_chunk_edit.jsp|id=' || C.id as nextedit1,\
''::varchar(255) as nextedit2,\
''::varchar(255) as nextedit3,\
1 as score\
from \
kb_chunk C \
left outer join kb_k_submission_type K \
on (C.submission_type=K.id)\
where 1=1\
/* and C.sachgebiete_id=<<Sachgebiet>> */\
/* and C.systeminfo_id=<<Komponente>> */\
/* and C.submission_type=<<Meldungsart>> */ \
and (1=1 \
/* and (1!=1 --<<Stichwort>> */\
/* or (lower(C.defaulttext) like lower('%${p.part}%')) --<<Stichwort>> */\
/* or (lower(C.longtext) like lower('%${p.part}%')) --<<Stichwort>> */\
/* or (lower(C.info_text) like lower('%${p.part}%')) --<<Stichwort>> */\
/* ) --<<Stichwort>> */\
)\
/* and C.submitted_by=<<Eingereicht von>> */\
/* and C.id in (select K.kb_chunk_id from kb_chunk2keyword K where K.kb_keyword_id=<<Schlüsselwort>>) */\
/* and C.id in (select K.kb_chunk_id from kb_chunk2ticket K where K.ticket_id = <<Ticket>>) */\
;\
</#foreach>\
\
select \
id ,\
submission_type ,\
submission_type_str ,\
defaulttext ,\
info_text ,\
nextedit0 ,\
nextedit1 ,\
nextedit2 ,\
nextedit3 ,\
sum(score) as score\
into tmp_k_chunk2\
from tmp_k_chunk\
group by \
id ,\
submission_type ,\
submission_type_str ,\
defaulttext ,\
info_text ,\
nextedit0 ,\
nextedit1 ,\
nextedit2 ,\
nextedit3 \
order by score desc\
;\
\
drop table tmp_k_chunk;\
\
--submission_type an view übergeben:\
update tmp_k_chunk set nextedit0=nextedit0 || '&submission_type=problem'\
update tmp_k_chunk2 set nextedit0=nextedit0 || '&submission_type=problem'\
where submission_type='Q';\
\
update tmp_k_chunk set nextedit0=nextedit0 || '&submission_type=loesung'\
update tmp_k_chunk2 set nextedit0=nextedit0 || '&submission_type=loesung'\
where submission_type='A';\
\
\
\
<@selectintotmp \
select="*"\
source="tmp_k_chunk"\
target="tmp_k_chunk2">\
source="tmp_k_chunk2"\
target="tmp_k_chunk3">\
where 1=1\
order by ord,defaulttext,submission_type_str\
order by score desc,defaulttext,submission_type_str\
</@selectintotmp>\
<@informixnolog/>;\
\
drop table tmp_k_chunk;\
\
drop table tmp_k_chunk2;\
\
select defaulttext,sp_trunc_string(info_text,50),nextedit0\
from tmp_k_chunk2;^XIL List\
select defaulttext,sp_trunc_string(info_text,50),nextedit0,score\
from tmp_k_chunk3;^XIL List\
sizable_columns horizontal_scrolling\
white_space_color=COLOR_WHITE fixed_columns=1\
min_heading_height=35\
@ -58,4 +174,7 @@ Column CID=0 heading_text="Meldung Inhalt" explanation="" center_heading\ @@ -58,4 +174,7 @@ Column CID=0 heading_text="Meldung Inhalt" explanation="" center_heading\
Column CID=0 heading_text="Meldung ansehen" explanation="" center_heading\
row_selectable col_selectable rightJust heading_platform readonly\
width=8\
@@@^Fachsemester^Anzahl^Öffentliches Suchformular für die Wissensbasis^drop table tmp_k_chunk2;^^1^600^360^0^^^
Column CID=0 heading_text="Score" explanation="" center_heading\
row_selectable col_selectable rightJust heading_platform readonly\
width=8\
@@@^Fachsemester^Anzahl^Öffentliches Suchformular für die Wissensbasis^drop table tmp_k_chunk3;^^1^600^360^^0^^

Loading…
Cancel
Save