Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/solr/indexes.tt
Jonathan Druart 623f3a2c84 Bug 8233 : SearchEngine: Add a Koha::SearchEngine module
First draft introducing solr into Koha :-)

List of files :
  $ tree t/searchengine/
  t/searchengine
  |-- 000_conn
  |   `-- conn.t
  |-- 001_search
  |   `-- search_base.t
  |-- 002_index
  |   `-- index_base.t
  |-- 003_query
  |   `-- buildquery.t
  |-- 004_config
  |   `-- load_config.t
  `-- indexes.yaml
  just do `prove -r t/searchengine/**/*.t`

  t/lib
  |-- Mocks
  |   `-- Context.pm
  `-- Mocks.pm
  provide a mock to SearchEngine syspref (set_zebra and set_solr).

  $ tree Koha/SearchEngine
  Koha/SearchEngine
  |-- Config.pm
  |-- ConfigRole.pm
  |-- FacetsBuilder.pm
  |-- FacetsBuilderRole.pm
  |-- Index.pm
  |-- IndexRole.pm
  |-- QueryBuilder.pm
  |-- QueryBuilderRole.pm
  |-- Search.pm
  |-- SearchRole.pm
  |-- Solr
  |   |-- Config.pm
  |   |-- FacetsBuilder.pm
  |   |-- Index.pm
  |   |-- QueryBuilder.pm
  |   `-- Search.pm
  |-- Solr.pm
  |-- Zebra
  |   |-- QueryBuilder.pm
  |   `-- Search.pm
  `-- Zebra.pm

How to install and configure Solr ?
  See the wiki page: http://wiki.koha-community.org/wiki/SearchEngine_Layer_RFC

http://bugs.koha-community.org/show_bug.cgi?id=8233
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
2012-07-06 16:51:58 +02:00

190 lines
8.2 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Solr config</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/tablednd.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.textarea-expander.js"></script>
<script type="text/javascript" language="javascript">
function clean_line( line ) {
$(line).find('input[type="text"]').val("");
$(line).find('input[type="checkbox"]').attr("checked", false);
$(line).find('textarea').val("");
$(line).find('select').find('option:first').attr("selected", "selected");
}
function clone_line( line ) {
var new_line = $(line).clone();
$(new_line).removeClass("nodrag nodrop");
$(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete"));
$(new_line).find('[data-id]').each( function() {
$(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id');
} );
$(new_line).find("select").each( function() {
var attr = $(this).attr('name');
var val = $(line).find('[data-id="' + attr + '"]').val();
$(this).find('option[value="' + val + '"]').attr("selected", "selected");
} );
return new_line;
}
$(document).ready(function() {
$('.delete').click(function() {
$(this).parents('tr').remove();
});
$(".indexes").tableDnD( {
onDragClass: "dragClass",
} );
$("textarea").TextAreaExpander();
$('.add').click(function() {
var table = $(this).closest('table');
var ressource_type = $(table).attr('data-ressource_type');
var code = $(table).find('input[data-id="code"]').val();
var label = $(table).find('input[data-id="label"]').val();
if ( code.length > 0 && label.length > 0 ) {
var line = $(this).closest("tr");
var mappings = $(line).find('textarea').val();
var new_line = clone_line( line );
$(new_line).find('textarea').val(mappings);
$(new_line).find("input:checkbox").val(code);
new_line.appendTo($('table[data-ressource_type="'+ressource_type+'"]>tbody'));
$('.delete').click(function() {
$(this).parents('tr').remove();
});
clean_line(line);
$(table).tableDnD( {
onDragClass: "dragClass",
} );
}
});
});
</script>
</head>
<body id="admin_searchengine_indexes" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Search engine configuration</div>
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1>Search engine configuration</h1>
<div class="warning">
Warning: Any modification in these configurations will need a total reindexation to be fully taken into account !
</div>
[% IF ( errors ) %]
<div class="error">
Errors occurred, Modifications does not apply. Please check following values:
<ul>
[% FOREACH e IN errors %]
<li>
[% IF ( e.type == "malformed_mapping" ) %]
The value "[% e.value %]" is not supported for mappings
[% ELSIF ( e.type == "no_mapping" ) %]
There is no mapping for the index [% e.value %]
[% END %]
</li>
[% END %]
</ul>
</div>
[% END %]
<form method="post">
<input type="hidden" name="op" value="edit" />
[% FOREACH rt IN indexloop %]
<h2>[% rt.ressource_type %]</h2>
[% IF ( rt.ressource_type == 'authority' ) %]
This part is not yet implemented
[% END %]
<table id="pouet" class="indexes" data-ressource_type="[% rt.ressource_type %]">
<thead>
<tr class="nodrag nodrop">
<th>Code</th>
<th>Label</th>
<th>Type</th>
<th>Sortable</th>
<th>Facetable</th>
<th>Mapping</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH index IN rt.indexes %]
<tr>
<td>
[% IF ( index.mandatory ) %]
<input name="code" type="text" maxlength="25" value="[% index.code %]" disabled="disabled" />
<input name="code" type="hidden" maxlength="25" value="[% index.code %]" />
[% ELSE %]
<input name="code" type="text" maxlength="25" value="[% index.code %]" />
[% END %]
<input name="mandatory" type="hidden" maxlength="1" value="[% index.mandatory %]" />
<input name="ressource_type" type="hidden" value="[% index.ressource_type %]" />
</td>
<td><input name="label" type="text" maxlength="25" value="[% index.label %]" /></td>
<td>
[% IF ( index.mandatory ) %]
<input type="hidden" name="type" value="[% index.type %]" />
[% END %]
<select name="type"[% IF ( index.mandatory ) %] disabled="disabled"[% END %]>
<option [% IF ( index.type == 'str' ) %] selected="selected"[% END %] value="str">String</option>
<option [% IF ( index.type == 'ste' ) %] selected="selected"[% END %] value="ste">Simple Text</option>
<option [% IF ( index.type == 'txt' ) %] selected="selected"[% END %] value="txt">Text</option>
<option [% IF ( index.type == 'int' ) %] selected="selected"[% END %] value="int">Integer</option>
<option [% IF ( index.type == 'date') %] selected="selected"[% END %] value="date">Date</option>
</select>
</td>
<td>
<input name="sortable" type="checkbox" [% IF ( index.sortable ) %]checked="checked"[% END %] value="[% index.code %]" />
</td>
<td>
<input name="facetable" type="checkbox" [% IF ( index.facetable ) %]checked="checked"[% END %] value="[% index.code %]" />
</td>
<td>
<textarea name="mappings" class="contentEditable">[% FOREACH m IN index.mappings %][% m %]
[% END %]</textarea> <!-- Don't indent this line -->
</td>
<td>[% UNLESS ( index.mandatory ) %]<a class="delete">Delete</a>[% END %]</td>
</tr>
[% END %]
</tbody>
<tfoot>
<tr class="nodrag nodrop">
<td>
<input data-id="code" type="text" maxlength="25" />
<input data-id="ressource_type" type="hidden" value="[% rt.ressource_type %]" />
<input data-id="mandatory" type="hidden" value="0" />
</td>
<td><input data-id="label" type="text" maxlength="25" /></td>
<td>
<select data-id="type">
<option value="str">String</option>
<option value="ste">Simple Text</option>
<option value="txt">Text</option>
<option value="int">Integer</option>
<option value="date">Date</option>
</select>
</td>
<td><input data-id="sortable" type="checkbox" /></td>
<td><input data-id="facetable" type="checkbox" /></td>
<td>
<textarea data-id="mappings" class="contentEditable"></textarea>
</td>
<td><a class="add">Add</a></td>
</tr>
</tfoot>
</table>
[% END %]
<p><input type="submit" value="Save" /></p>
</form>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]