Commit 4d95be2a authored by Frank Bergmann's avatar Frank Bergmann

- OpenACS 5.9

parent d494290f
<?xml version="1.0" encoding="utf-8"?>
<message_catalog package_key="search" locale="ru_RU" charset="utf-8">
<msg key="________Search_took">. Поиск занял</msg>
<msg key="________Search_took">.Диапазон поиска</msg>
<msg key="Advanced_Search">Расширенный поиск</msg>
<msg key="advanced_search">&quot;расширенный поиск&quot;</msg>
<msg key="anytime">любая дата</msg>
<msg key="anytime">в любое время</msg>
<msg key="Date_Range">Диапазон дат</msg>
<msg key="details">подробности</msg>
<msg key="Feeling_Lucky">Мне повезет</msg>
<msg key="lt_bstopwordsb_is_a_very">&quot;&lt;b&gt;%stopwords%&lt;/b&gt;&quot; является очень популярным словом, поэтому оно исключено из результатов поиска.</msg>
<msg key="lt_FtsEngineDriver_not_a">FtsEngineDriver недоступен!</msg>
<msg key="lt_Make_sure_all_words_a">Убедитесь, что в тексте нет опечаток.</msg>
<msg key="lt_No_pages_were_found_c">Не удалось найти страницы, содержащие &quot;</msg>
<msg key="lt_The_following_words_a">Следующие слова являются очень популярными, поэтому они исключены из результатов поиска:</msg>
<msg key="lt_Tip_In_most_browsers_">Совет. В большинстве браузеров вместо того чтобы щелкать кнопку поиска можно нажать клавишу ВВОД.</msg>
<msg key="lt_Try_different_keyword">Попробуйте другие ключевые слова.</msg>
<msg key="lt_Try_more_general_keyw">Попробуйте более общие ключевые слова.</msg>
<msg key="lt_Try_your_query_on_stw">Попробуйте изменить запрос: %stw;noquote%</msg>
<msg key="lt_You_must_specify_some">Необходимо указать ключевые слова</msg>
<msg key="nbspDisplay">и показать</msg>
<msg key="Next">Далее</msg>
<msg key="of_about">из приблизительно</msg>
<msg key="past_3_months">последние 3 месяца</msg>
<msg key="past_6_months">последние 6 месяцев</msg>
<msg key="Enter_keywords_to_search_for">Ввести ключевые слова для поиска</msg>
<msg key="Feeling_Lucky">Мне повезёт</msg>
<msg key="lt_bstopwordsb_is_a_very">&quot;&lt;b&gt;%stopwords%&lt;/b&gt;&quot; очень общее слово и оно не было включено в ваш поисковый запрос.</msg>
<msg key="lt_FtsEngineDriver_not_a">FtsEngineDriver отсутствует!</msg>
<msg key="lt_Make_sure_all_words_a">Проверьте правильность написания всех слов.</msg>
<msg key="lt_No_pages_were_found_c">Не найдено страниц, содержащих &quot;</msg>
<msg key="lt_The_following_words_a">Следующие слова слишком общие и не были включены в ваш поисковый запрос:</msg>
<msg key="lt_Tip_In_most_browsers_">Подсказка: В большинстве броузеров вы можете нажать клавишу Назад вместо кнопки поиск.</msg>
<msg key="lt_Try_different_keyword">Попробуйте разные ключевые слова.</msg>
<msg key="lt_Try_more_general_keyw">Попробуйте использовать более общие ключевые слова.</msg>
<msg key="lt_Try_your_query_on_stw">Попробуйте ваши запросы на: %stw;noquote%</msg>
<msg key="lt_You_must_specify_some">Вы должны определить несколько ключевых слов</msg>
<msg key="nbspDisplay">&amp;nbsp;Дисплей</msg>
<msg key="Next">Следующий</msg>
<msg key="of_about">о(об)</msg>
<msg key="past_3_months">за последние три месяца</msg>
<msg key="past_6_months">за последние 6 месяцев</msg>
<msg key="past_year">последний год</msg>
<msg key="Previous">Назад</msg>
<msg key="Result_page">Страница результатов:</msg>
<msg key="Previous">Предыдущий</msg>
<msg key="Result_page">Последняя страница:</msg>
<msg key="Results">Результаты</msg>
<msg key="results">результаты</msg>
<msg key="Search">Поиск</msg>
<msg key="Searched_for_query">Искомый текст: %query%</msg>
<msg key="seconds">с</msg>
<msg key="selected">выбран</msg>
<msg key="Searched_for_query">Результаты поисков для &lt;strong&gt;%query%&lt;/strong&gt;</msg>
<msg key="seconds">секунд.</msg>
<msg key="selected">выбрано</msg>
<msg key="Suggestions">Предложения:</msg>
<msg key="The">Оператор &quot;&lt;b&gt;AND&lt;/b&gt;&quot; необязателен - по умолчанию выполняется поиск по всем словам.</msg>
<msg key="Try_fewer_keywords">Попробуйте задать меньше ключевых слов.</msg>
<msg key="Untitled">Без названия</msg>
<msg key="The">&quot;&lt;b&gt;AND&lt;/b&gt;&quot; лишняя операция -- все элементы поиска включены по умолчанию.</msg>
<msg key="Try_fewer_keywords">Попробуйте сократить количество ключевых слов.</msg>
<msg key="Untitled">Без названия </msg>
</message_catalog>
......@@ -47,3 +47,11 @@ for { set __i $from_result_page } { $__i <= $to_result_page} { incr __i } {
append link "&num=$num"
template::multirow append results_paginator [expr {$__i + 1}] $link [expr {$__i == $current_result_page}]
}
ad_return_template [template::themed_template /packages/search/lib/navbar]
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -2,3 +2,9 @@ set base_url [site_node::get_package_url -package_key search]
set search_url "${base_url}search"
set advanced_search_url "${base_url}advanced-search"
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -9,17 +9,18 @@
<implements-subsite-p>f</implements-subsite-p>
<inherit-templates-p>t</inherit-templates-p>
<version name="5.10.0d1" url="http://openacs.org/repository/download/apm/search-5.10.0d1.apm">
<version name="5.9.0" url="http://openacs.org/repository/download/apm/search-5.9.0.apm">
<owner url="http://openacs.org">OpenACS</owner>
<summary>Site wide search</summary>
<release-date>2013-10-01</release-date>
<release-date>2015-10-04</release-date>
<vendor url="http://openacs.org">OpenACS</vendor>
<description format="text/html">Site wide search implemented with service contracts, currently supports postgres via the tsearch2 driver (OpenFTS still support but deprecated).</description>
<license>GPL version 2</license>
<maturity>3</maturity>
<provides url="search" version="5.10.0d1"/>
<requires url="acs-service-contract" version="5.10.0d1"/>
<provides url="search" version="5.9.0"/>
<requires url="acs-service-contract" version="5.9.0"/>
<requires url="acs-templating" version="5.9.0"/>
<callbacks>
<callback type="after-instantiate" proc="search::install::after_instantiate"/>
......
......@@ -19,3 +19,9 @@ ad_proc search::install::after_instantiate {
}
}
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -33,4 +33,9 @@ ad_proc -callback search::extra_arg -impl package_ids {
return [list]
}
return [list from_clause {} where_clause "$object_table_alias.package_id in ([template::util::tcl_to_sql_list $value])"]
}
\ No newline at end of file
}
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -92,3 +92,9 @@ ad_proc -public search::convert::binary_to_text {
}
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -24,3 +24,9 @@ ad_proc -private search::init::schedule_indexer {} {
}
search::init::schedule_indexer
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -481,3 +481,9 @@ ad_proc search::extra_args {
}
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -58,3 +58,9 @@ ad_proc -public -callback search::action -impl syndicate {} {
db_dml insert {insert into syndication(object_id, rss_xml_frag, body, url) values (:object_id, :rss_xml_frag, :body, :url)}
}
}
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -16,4 +16,9 @@ set context "advanced search"
set context_bar [ad_context_bar $title]
ad_return_template
\ No newline at end of file
ad_return_template
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
<property name="context">{/doc/search {Search}} {How to make an object type searchable?}</property>
<property name="doc(title)">How to make an object type searchable?</property>
<master>
<blockquote>
<h2>How to make an object type searchable?</h2>
by Neophytos Demetriou (<a href="mailto:k2pts\@cytanet.com.cy">k2pts\@cytanet.com.cy</a>)
<hr>
Making an object type searchable involves three steps:
<ul>
<li>Choose the object type</li><li>Implement FtsContentProvider</li><li>Add triggers</li>
</ul><h3>Choose the object type</h3>
In most of the cases, choosing the object type is straightforward.
However, if your object type uses the content repository then you
should make sure that your object type is a subclass of the
"content_revision" class. You should also make sure all content is
created using that subclass, rather than simply create content with
the "content_revision" type.
<ul>
<li>Object types that don't use the CR, can be specified using
<code>acs_object_type__create_type</code>, but those that use the
CR need to use <code>content_type__create_type</code>.
<code>content_type__create_type</code> overloads
<code>acs_object_type__create_type</code> and provides two views
for inserting and viewing content data, and the CR depends on these
views.</li><li>Whenever you call content_item__new, call it with
'content_revision' as the item_subtype and 'your_content_type' as
the content_type.</li>
</ul><h3>Implement FtsContentProvider</h3>
FtsContentProvider is comprised of two abstract operations, namely
<code>datasource</code> and <code>url</code>. The specification for
these operations can be found in
<code>packages/search/sql/postgresql/search-sc-create.sql</code>.
You have to implement these operations for your object type by
writing concrete functions that follow the specification. For
example, the implementation of <code>datasource</code> for the
object type <code>note</code>, looks like this:
<pre><code>ad_proc notes__datasource {
object_id
} {
\@author Neophytos Demetriou
} {
db_0or1row notes_datasource {
select n.note_id as object_id,
n.title as title,
n.body as content,
'text/plain' as mime,
'' as keywords,
'text' as storage_type
from notes n
where note_id = :object_id
} -column_array datasource
return [array get datasource]
}
</code></pre>
When you are done with the implementation of
<code>FtsContentProvider</code> operations, you should let the
system know of your implementation. This is accomplished by an SQL
file which associates the implementation with a contract name. The
implementation of <code>FtsContentProvider</code> for the object
type <code>note</code> looks like:
<pre><code>select acs_sc_impl__new(
'FtsContentProvider', -- impl_contract_name
'note', -- impl_name
'notes' -- impl_owner_name
);
</code></pre>
You should adapt this association to reflect your implementation.
That is, change <code>impl_name</code> with your object type and
the <code>impl_owner_name</code> to the package key. Next, you have
to create associations between the operations of
<code>FtsContentProvider</code> and your concrete functions. Here's
how an association between an operation and a concrete function
looks like:
<pre><code>select acs_sc_impl_alias__new(
'FtsContentProvider', -- impl_contract_name
'note', -- impl_name
'datasource', -- impl_operation_name
'notes__datasource', -- impl_alias
'TCL' -- impl_pl
);
</code></pre>
Again, you have to make some changes. Change the
<code>impl_name</code> from <code>note</code> to your object type
and the <code>impl_alias</code> from <code>notes__datasource</code>
to the name that you gave to the function that implements the
operation <code>datasource</code>.
<h3>Add triggers</h3>
If your object type uses the content repository to store its items,
then you are done. If not, an extra step is required to inform the
search_observer_queue of new content items, updates or deletions.
We do this by adding triggers on the table that stores the content
items of your object type. Here's how that part looks like for
<code>note</code>.
<pre><code>create function notes__itrg ()
returns opaque as $$
begin
perform search_observer__enqueue(new.note_id,'INSERT');
return new;
end;
$$ language plpgsql;
create function notes__dtrg ()
returns opaque as $$
begin
perform search_observer__enqueue(old.note_id,'DELETE');
return old;
end;
$$ language plpgsql;
create function notes__utrg ()
returns opaque as $$
begin
perform search_observer__enqueue(old.note_id,'UPDATE');
return old;
end;
$$ language plpgsql;
create trigger notes__itrg after insert on notes
for each row execute procedure notes__itrg ();
create trigger notes__dtrg after delete on notes
for each row execute procedure notes__dtrg ();
create trigger notes__utrg after update on notes
for each row execute procedure notes__utrg ();
</code></pre><h3>Questions &amp; Answers</h3><ol>
<li>Q: If content is some binary file (like a pdf file stored in
file storage, for example), will the content still be
indexable/searchable?<br><br>
A: For each mime type we require some type of handler. Once the
handler is available, i.e. pdf2txt, it is very easy to incorporate
support for that mime type into the search package. Content items
with unsupported mime types will be ignored by the indexer.<br><br>
</li><li>Q: Can the search package handle lobs and files?<br><br>
A: Yes, the search package will convert everything into text based
on the content and storage_type attributes. Here is the convention
to use while writing the implementation of datasource:<br><br><ul>
<li>Content is a filename when storage_type='file'.</li><li>Content is a lob id when storage_type='lob'.</li><li>Content is text when storage_type='text'.</li>
</ul>
</li>
</ol>
</blockquote>
<property name="context">{/doc/search {Search}} {Search}</property>
<property name="doc(title)">Search</property>
<master>
<h1>Search</h1>
<a href="../">OpenACS documentation</a>
<ul><li><a href="./guidelines">How to make an object
searchable</a></li></ul>
<hr>
<h2>Release Notes</h2>
<p>Please file bugs in the <a href="http://openacs.org/bugtracker/openacs/">Bug Tracker</a>.</p>
<address><a href="mailto:vkurup\@massmed.org">Vinod
Kurup</a></address>
<!-- Created: Fri Sep 13 08:36:28 EDT 2002 --><!-- hhmts start -->Last modified: Fri Aug 21 12:14:30 CEST 2015
<!-- hhmts end -->
\ No newline at end of file
......@@ -9,13 +9,17 @@
<a href="../">OpenACS documentation</a>
<hr>
<ul>
<li><a href="./guidelines.html">How to make an object searchable</a></li>
<li><a href="./guidelines">How to make an object searchable</a></li>
</ul>
<hr>
<hr>
<h2>Release Notes</h2>
<p>Please file bugs in the <a
href="http://openacs.org/bugtracker/openacs/">Bug
Tracker</a>.</p>
<address><a href="mailto:vkurup@massmed.org">Vinod Kurup</a></address>
<!-- Created: Fri Sep 13 08:36:28 EDT 2002 -->
<!-- hhmts start -->
Last modified: Fri Sep 13 08:44:16 EDT 2002
<!-- hhmts end -->
<!-- hhmts start -->Last modified: Fri Aug 21 12:14:30 CEST 2015 <!-- hhmts end -->
</body>
</html>
# Nothing to see here...
ad_return_template
\ No newline at end of file
ad_return_template
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
......@@ -38,7 +38,7 @@
<div id="search-info">
<p class="subtitle">#search.Searched_for_query#</p>
<p class="times">
#search.Results# <strong>@low@-@high@</strong> #search.of_about# <strong>@count@</strong>#search.________Search_took# <strong>@elapsed@</strong> #search.seconds#
#search.Results# <strong>@low@-@high@</strong> #search.of_about# <strong>@result.count@</strong>#search.________Search_took# <strong>@elapsed@</strong> #search.seconds#
</p>
</div>
<div id="search-results">
......
......@@ -197,3 +197,9 @@ if {$search_the_web ne ""} {
template::head::add_css \
-href "/resources/search/search.css" \
-media "all"
# Local variables:
# mode: tcl
# tcl-indent-level: 4
# indent-tabs-mode: nil
# End:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment