v5 v6: cgi, sample search form, find & display endnotes from parent text object sisu_5.7.1
authorRalph Amissah <ralph@amissah.com>
Mon, 20 Oct 2014 01:17:49 +0000 (21:17 -0400)
committerRalph Amissah <ralph@amissah.com>
Mon, 20 Oct 2014 01:17:49 +0000 (21:17 -0400)
* remove dedicated endnote search section (as endnotes found & listed from
  reference text field)
* cleaner search results

data/doc/sisu/CHANGELOG_v5
data/doc/sisu/CHANGELOG_v6
lib/sisu/v5/cgi_pgsql.rb
lib/sisu/v5/cgi_sql_common.rb
lib/sisu/v5/cgi_sqlite.rb
lib/sisu/v6/cgi_pgsql.rb
lib/sisu/v6/cgi_sql_common.rb
lib/sisu/v6/cgi_sqlite.rb

index 39591639b9e43a300fb7598addfff950f03fa7d0..dba956393efe18e327a68293e1ecd52cb53d76a1 100644 (file)
@@ -47,6 +47,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.7.1.orig.tar.xz
   * cleaner text search field
   * separate footnote fields redundant for search purposes
 
+* cgi, sample search form, find & display endnotes from parent text object
+  * remove dedicated endnote search section (as endnotes found & listed from
+    reference text field)
+  * cleaner search results
+
 %% 5.7.0.orig.tar.xz (2014-10-12:40/7)
 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.7.0
 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.7.0-1
index 6a76425c81ada7b9c743365d63bd6c41baea7db1..3dfdc8508f155f151bf9d175c9a27f4f3238c9fd 100644 (file)
@@ -37,6 +37,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.3.1.orig.tar.xz
   * cleaner text search field
   * separate footnote fields redundant for search purposes
 
+* cgi, sample search form, find & display endnotes from parent text object
+  * remove dedicated endnote search section (as endnotes found & listed from
+    reference text field)
+  * cleaner search results
+
 %% 6.3.0.orig.tar.xz (2014-10-12:40/7)
 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.3.0
 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.3.0-1
index 8b4210e0bfb9ded670849928db6e145d96ff49e4..3ae98ffe07db7785c801d59db412feff5be124dc 100644 (file)
@@ -233,11 +233,9 @@ module  SiSU_CGI_PgSQL                                  #% database building doc
     end
     def search_query1
       <<-'WOK_SQL'
-          @search_text,@search_endnotes='',''
+          @search_text=''
           @search_text=search[:text].flatten.join(' AND ')
           @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
-          @search_endnotes=search[:endnotes].flatten.join(' AND ')
-          @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
         end
       WOK_SQL
     end
@@ -251,26 +249,12 @@ module  SiSU_CGI_PgSQL                                  #% database building doc
           select=@sql_statement[:body] + ' ' + @sql_statement[:range]
           select
         end
-        def sql_select_endnotes
-          limit ||=@@limit
-          offset ||=@@offset
-          @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
-          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
-          select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
-          select
-        end
         def sql_select_body_format
           %{<font color="#666666" size="2">#{sql_select_body}</font>}
         end
-        def sql_select_endnotes_format
-          %{<font color="#666666" size="2">#{sql_select_endnotes}</font>}
-        end
         def contents
           @conn.exec(sql_select_body)
         end
-        def endnotes
-          @conn.exec(sql_select_endnotes)
-        end
       end
       WOK_SQL
     end
index eb8ce0ab0582440f8e3b3818cf3a68888d43f7dc..4d2304bae69eb86e08b62e8ee7c66d9d7ca8e6d0 100644 (file)
@@ -331,7 +331,7 @@ module SiSU_CGI_SQL
     def search_statement_common
       <<-'WOK_SQL'
       class DBI_SearchStatement
-        attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit
+        attr_reader :text_search_flag,:sql_select_body_format,:sql_offset,:sql_limit
         def initialize(conn,search_for,q,c)
           @conn=conn
           @text_search_flag=false
@@ -345,107 +345,86 @@ module SiSU_CGI_SQL
           @text_search_flag=st[:flag]
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << se[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           @@limit=q['ltd'] if q['ltd']=~/\d+/  # 1000
           @@offset=q['off'] if q['off']=~/\d+/ # 0
@@ -648,7 +627,7 @@ module SiSU_CGI_SQL
       <<-'WOK_SQL'
       @tail=tail
       @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0
-      @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''
+      @counters_txt,@counters_endn,@sql_select_body='','',''
       FCGI.each_cgi do |cgi|
         begin # all code goes in begin section
           @search={ text: [], endnotes: [] }
@@ -739,10 +718,8 @@ module SiSU_CGI_SQL
             @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}"
             if checked_case=~/\S/
               @search[:text][1]=%{doc_objects.clean~'#{@search_for.text1}'} #s1
-              @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1
             else
               @search[:text][1]=%{doc_objects.clean~*'#{@search_for.text1}'} #s1
-              @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1
             end
             canned_note='search url:'
           else
@@ -811,28 +788,23 @@ module SiSU_CGI_SQL
           : 'Unavailable'
           if checked_case=~/\S/
             @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'}
-            @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'}
           else
             @search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'}
-            @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'}
           end
           #% dbi_request
           dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case)
           @text_search_flag=false
           @text_search_flag=dbi_statement.text_search_flag
           s_contents=dbi_statement.contents
-          s_endnotes=dbi_statement.endnotes
-          @body_main,@endnotes='',''
+          @body_main=''
           @search_regx=nil
           oldtid=0
           if @text_search_flag
             if checked_sql =~/\S/
               sql_select_body=dbi_statement.sql_select_body_format
-              sql_select_endnotes=dbi_statement.sql_select_endnotes_format
-            else sql_select_body,sql_select_endnotes='',''
+            else sql_select_body=''
             end
-            @body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body
-            @endnotes  << '<p><hr><br /><b>Endnotes:</b><br />'  << sql_select_endnotes
+            @body_main << sql_select_body
           else
           end
           @hostpath="#{@hosturl_files}/#{@stub}"
@@ -884,16 +856,6 @@ module SiSU_CGI_SQL
               "#{path_html_seg(fn,ln)}/#{seg}.html"
             end
           end
-          def path_endnotes(fn,ln=nil)
-            if @output_dir_structure_by =='filename' \
-            or @output_dir_structure_by =='filetype'
-              @lingual =='mono' \
-              ? "#{path_html_seg(fn,ln)}/endnotes.html"
-              : "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html"
-            else
-              "#{path_html_seg(fn,ln)}/endnotes.html"
-            end
-          end
           def path_html_doc(fn,ln=nil)
             case @output_dir_structure_by
             when 'filename'
@@ -1003,56 +965,7 @@ module SiSU_CGI_SQL
             end
             @body_main << output #+ details
           end
-          #text_objects_endnote
           oldtid = 0
-          s_endnotes.each do |e|                                               #% endnotes
-            location=e['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
-            file_suffix=e['src_filename'][/.+?\.(ssm\.sst|sst)$/,1]
-            lang=if location =~ /\S+?~(\S\S\S?)$/
-              l=location[/\S+?~(\S\S\S?)$/,1]
-              location=location.gsub(/(\S+?)~\S\S\S?/,'\1')
-              l=".#{l}"
-            else ''
-            end
-            #metadata_found_endnotes
-            if @text_search_flag
-              if e['metadata_tid'].to_i != oldtid.to_i
-                ti=e['title']
-                can_txt_srch=(cgi['view']=~/index/) \
-                ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
-                : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
-                title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{path_manifest(location,e['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/
-                @counter_endn_doc+=1
-                oldtid=e['metadata_tid'].to_i
-              else title = ''
-              end
-              if cgi['view']=~/text/ \
-              or (cgi['view']!~/index/ and cgi['search'] !~/search db/)      #% txt endnotes
-                @counter_endn_ocn+=1
-                matched_endnote=(@search_regx.to_s.is_a?(String) \
-                && @search_regx.to_s=~/\S\S+/) \
-                ? (matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}))
-                : e['body']
-                output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}
-              else #elsif cgi['view']=~/index/      #doc #FIX                           #% idx endnotes
-                @counter_endn_ocn+=1
-                output=%{#{title}<a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a> [&sect; <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>], }
-              end
-              @counters_endn=if @counter_endn_doc > 0
-                if checked_stats =~/\S/
-                  @@lt_e=@counter_endn_ocn==dbi_statement.sql_match_limit.to_i \
-                  ? true
-                  : false
-                  start=(@@offset.to_i+1).to_s
-                  range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s
-                  %{<font size="2" color="#666666">Found #{@counter_endn_ocn} times in the endnotes of #{@counter_endn_doc} documents [ matches #{start} to #{range} ]</font><br />}
-                else ''
-                end
-              end
-              @endnotes << output #+ details
-            else @endnotes='' #does not take out yet
-            end
-          end
           offset=dbi_statement.sql_offset.to_s
           limit=dbi_statement.sql_match_limit.to_s
           @@lt_t ||=false; @@lt_e ||=false
@@ -1060,7 +973,7 @@ module SiSU_CGI_SQL
           ? dbi_statement.pre_next(true,@image_src).to_s
           : dbi_statement.pre_next(false,@image_src).to_s
           limit=dbi_statement.sql_match_limit.to_s
-          cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes
+          cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body
         end
         rescue Exception => e
           s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
index 2b4e668fdca28621741f9a90abc0566f29400988..8f3f58ebb806641cf192da246c54283befa07400 100644 (file)
@@ -211,11 +211,9 @@ module  SiSU_CGI_SQLite                                 #% database building doc
     end
     def search_query1
       <<-'WOK_SQL'
-          @search_text,@search_endnotes='',''
+          @search_text=''
           @search_text=search[:text].flatten.join(' AND ')
           @search_text=@search_text.gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
-          @search_endnotes=search[:endnotes].flatten.join(' AND ')
-          @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
         end
       WOK_SQL
     end
@@ -229,26 +227,12 @@ module  SiSU_CGI_SQLite                                 #% database building doc
           select=@sql_statement[:body] + ' ' + @sql_statement[:range]
           select
         end
-        def sql_select_endnotes
-          limit ||=@@limit
-          offset ||=@@offset
-          @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
-          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
-          select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
-          select
-        end
         def sql_select_body_format
           %{<font color="#666666" size="2">#{sql_select_body}</font>}
         end
-        def sql_select_endnotes_format
-          %{<font color="#666666" size="2">#{sql_select_endnotes}</font>}
-        end
         def contents
           @conn.execute(sql_select_body)
         end
-        def endnotes
-          @conn.execute(sql_select_endnotes)
-        end
       end
       WOK_SQL
     end
index 9feffd406ab64190cc51a17fb29b5bf55abb31a9..49ab0e50aee59f67eafb9a1e801cb50feb8e7a5e 100644 (file)
@@ -233,11 +233,9 @@ module  SiSU_CGI_PgSQL                                  #% database building doc
     end
     def search_query1
       <<-'WOK_SQL'
-          @search_text,@search_endnotes='',''
+          @search_text=''
           @search_text=search[:text].flatten.join(' AND ')
           @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
-          @search_endnotes=search[:endnotes].flatten.join(' AND ')
-          @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
         end
       WOK_SQL
     end
@@ -251,26 +249,12 @@ module  SiSU_CGI_PgSQL                                  #% database building doc
           select=@sql_statement[:body] + ' ' + @sql_statement[:range]
           select
         end
-        def sql_select_endnotes
-          limit ||=@@limit
-          offset ||=@@offset
-          @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
-          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
-          select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
-          select
-        end
         def sql_select_body_format
           %{<font color="#666666" size="2">#{sql_select_body}</font>}
         end
-        def sql_select_endnotes_format
-          %{<font color="#666666" size="2">#{sql_select_endnotes}</font>}
-        end
         def contents
           @conn.exec(sql_select_body)
         end
-        def endnotes
-          @conn.exec(sql_select_endnotes)
-        end
       end
       WOK_SQL
     end
index 0bc663d046f384bb57f308d13f52e53897dcb253..6976e042ef75ce3c16fff698eef019afdc47e444 100644 (file)
@@ -331,7 +331,7 @@ module SiSU_CGI_SQL
     def search_statement_common
       <<-'WOK_SQL'
       class DBI_SearchStatement
-        attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit
+        attr_reader :text_search_flag,:sql_select_body_format,:sql_offset,:sql_limit
         def initialize(conn,search_for,q,c)
           @conn=conn
           @text_search_flag=false
@@ -345,107 +345,86 @@ module SiSU_CGI_SQL
           @text_search_flag=st[:flag]
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << se[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           st=DBI_SearchString.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string
           if st[:flag]
             search[:text]                    << st[:search]
-            search[:endnotes]                << st[:search]
           end
           @@limit=q['ltd'] if q['ltd']=~/\d+/  # 1000
           @@offset=q['off'] if q['off']=~/\d+/ # 0
@@ -648,7 +627,7 @@ module SiSU_CGI_SQL
       <<-'WOK_SQL'
       @tail=tail
       @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0
-      @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''
+      @counters_txt,@counters_endn,@sql_select_body='','',''
       FCGI.each_cgi do |cgi|
         begin # all code goes in begin section
           @search={ text: [], endnotes: [] }
@@ -739,10 +718,8 @@ module SiSU_CGI_SQL
             @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}"
             if checked_case=~/\S/
               @search[:text][1]=%{doc_objects.clean~'#{@search_for.text1}'} #s1
-              @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1
             else
               @search[:text][1]=%{doc_objects.clean~*'#{@search_for.text1}'} #s1
-              @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1
             end
             canned_note='search url:'
           else
@@ -811,28 +788,23 @@ module SiSU_CGI_SQL
           : 'Unavailable'
           if checked_case=~/\S/
             @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'}
-            @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'}
           else
             @search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'}
-            @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'}
           end
           #% dbi_request
           dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case)
           @text_search_flag=false
           @text_search_flag=dbi_statement.text_search_flag
           s_contents=dbi_statement.contents
-          s_endnotes=dbi_statement.endnotes
-          @body_main,@endnotes='',''
+          @body_main=''
           @search_regx=nil
           oldtid=0
           if @text_search_flag
             if checked_sql =~/\S/
               sql_select_body=dbi_statement.sql_select_body_format
-              sql_select_endnotes=dbi_statement.sql_select_endnotes_format
-            else sql_select_body,sql_select_endnotes='',''
+            else sql_select_body=''
             end
-            @body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body
-            @endnotes  << '<p><hr><br /><b>Endnotes:</b><br />'  << sql_select_endnotes
+            @body_main << sql_select_body
           else
           end
           @hostpath="#{@hosturl_files}/#{@stub}"
@@ -884,16 +856,6 @@ module SiSU_CGI_SQL
               "#{path_html_seg(fn,ln)}/#{seg}.html"
             end
           end
-          def path_endnotes(fn,ln=nil)
-            if @output_dir_structure_by =='filename' \
-            or @output_dir_structure_by =='filetype'
-              @lingual =='mono' \
-              ? "#{path_html_seg(fn,ln)}/endnotes.html"
-              : "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html"
-            else
-              "#{path_html_seg(fn,ln)}/endnotes.html"
-            end
-          end
           def path_html_doc(fn,ln=nil)
             case @output_dir_structure_by
             when 'filename'
@@ -1003,56 +965,7 @@ module SiSU_CGI_SQL
             end
             @body_main << output #+ details
           end
-          #text_objects_endnote
           oldtid = 0
-          s_endnotes.each do |e|                                               #% endnotes
-            location=e['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
-            file_suffix=e['src_filename'][/.+?\.(ssm\.sst|sst)$/,1]
-            lang=if location =~ /\S+?~(\S\S\S?)$/
-              l=location[/\S+?~(\S\S\S?)$/,1]
-              location=location.gsub(/(\S+?)~\S\S\S?/,'\1')
-              l=".#{l}"
-            else ''
-            end
-            #metadata_found_endnotes
-            if @text_search_flag
-              if e['metadata_tid'].to_i != oldtid.to_i
-                ti=e['title']
-                can_txt_srch=(cgi['view']=~/index/) \
-                ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
-                : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
-                title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{path_manifest(location,e['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/
-                @counter_endn_doc+=1
-                oldtid=e['metadata_tid'].to_i
-              else title = ''
-              end
-              if cgi['view']=~/text/ \
-              or (cgi['view']!~/index/ and cgi['search'] !~/search db/)      #% txt endnotes
-                @counter_endn_ocn+=1
-                matched_endnote=(@search_regx.to_s.is_a?(String) \
-                && @search_regx.to_s=~/\S\S+/) \
-                ? (matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}))
-                : e['body']
-                output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}
-              else #elsif cgi['view']=~/index/      #doc #FIX                           #% idx endnotes
-                @counter_endn_ocn+=1
-                output=%{#{title}<a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a> [&sect; <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>], }
-              end
-              @counters_endn=if @counter_endn_doc > 0
-                if checked_stats =~/\S/
-                  @@lt_e=@counter_endn_ocn==dbi_statement.sql_match_limit.to_i \
-                  ? true
-                  : false
-                  start=(@@offset.to_i+1).to_s
-                  range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s
-                  %{<font size="2" color="#666666">Found #{@counter_endn_ocn} times in the endnotes of #{@counter_endn_doc} documents [ matches #{start} to #{range} ]</font><br />}
-                else ''
-                end
-              end
-              @endnotes << output #+ details
-            else @endnotes='' #does not take out yet
-            end
-          end
           offset=dbi_statement.sql_offset.to_s
           limit=dbi_statement.sql_match_limit.to_s
           @@lt_t ||=false; @@lt_e ||=false
@@ -1060,7 +973,7 @@ module SiSU_CGI_SQL
           ? dbi_statement.pre_next(true,@image_src).to_s
           : dbi_statement.pre_next(false,@image_src).to_s
           limit=dbi_statement.sql_match_limit.to_s
-          cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes
+          cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body
         end
         rescue Exception => e
           s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
index d9b1559d2aa71acb7173ef0b50925a4b45af85ba..d11d4c30023f6fd2e5270d14d78a9cc6ef8182f9 100644 (file)
@@ -211,11 +211,9 @@ module  SiSU_CGI_SQLite                                 #% database building doc
     end
     def search_query1
       <<-'WOK_SQL'
-          @search_text,@search_endnotes='',''
+          @search_text=''
           @search_text=search[:text].flatten.join(' AND ')
           @search_text=@search_text.gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
-          @search_endnotes=search[:endnotes].flatten.join(' AND ')
-          @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
         end
       WOK_SQL
     end
@@ -229,26 +227,12 @@ module  SiSU_CGI_SQLite                                 #% database building doc
           select=@sql_statement[:body] + ' ' + @sql_statement[:range]
           select
         end
-        def sql_select_endnotes
-          limit ||=@@limit
-          offset ||=@@offset
-          @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr}
-          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
-          select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
-          select
-        end
         def sql_select_body_format
           %{<font color="#666666" size="2">#{sql_select_body}</font>}
         end
-        def sql_select_endnotes_format
-          %{<font color="#666666" size="2">#{sql_select_endnotes}</font>}
-        end
         def contents
           @conn.execute(sql_select_body)
         end
-        def endnotes
-          @conn.execute(sql_select_endnotes)
-        end
       end
       WOK_SQL
     end