mirror of https://github.com/apache/lucene.git
77 lines
2.9 KiB
HTML
77 lines
2.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
this work for additional information regarding copyright ownership.
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
(the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<html>
|
|
<head>
|
|
<style type="text/css">
|
|
body { font-family: Arial, sans; font-size: 0.8em}
|
|
</style>
|
|
|
|
<script src="../lib/jquery/jquery-1.2.6.js"></script>
|
|
<script src="../src/core/Core.js"></script>
|
|
<script src="../src/core/QueryItem.js"></script>
|
|
<script src="../src/core/Manager.js"></script>
|
|
<script src="../src/core/AbstractWidget.js"></script>
|
|
<script src="../src/core/AbstractServerSideWidget.js"></script>
|
|
<script src="../src/core/AbstractClientSideWidget.js"></script>
|
|
<script src="../src/clientside/ExtensibleResultWidget.js"/></script>
|
|
<script src="../src/clientside/FacetWidget.js"/></script>
|
|
<script>
|
|
var $sj = jQuery.noConflict();
|
|
</script>
|
|
|
|
|
|
<script>
|
|
var solrjsManager;
|
|
$sj(document).ready(function(){
|
|
solrjsManager = new $sj.solrjs.Manager({solrUrl:"http://localhost:8983/solr/select"});
|
|
// a custom result widget
|
|
var resultWidget = new $sj.solrjs.ExtensibleResultWidget({
|
|
id:"result",
|
|
target:"#result",
|
|
rows:20,
|
|
renderResult : function(docs, pageSize, offset) {
|
|
var container = jQuery("<div/>");
|
|
$sj.each(docs, function(i, item) {
|
|
jQuery("<h3/>").html(item["name"]).appendTo(container);
|
|
if (item["cat"] != null) {
|
|
jQuery("<p/>").html(item["cat"].toString()).appendTo(container);
|
|
}
|
|
jQuery("<p/>").html(item["name"]).appendTo(container);
|
|
jQuery("<hr/>").appendTo(container);
|
|
});
|
|
container.appendTo(this.target);
|
|
}
|
|
});
|
|
|
|
solrjsManager.addWidget(resultWidget);
|
|
solrjsManager.addWidget(new $sj.solrjs.FacetWidget({id:"categories", target:"#categories", fieldName:"cat"}));
|
|
solrjsManager.doRequestAll();
|
|
});
|
|
</script>
|
|
<style>img{ height: 100px; float: left; }</style>
|
|
</head>
|
|
<body>
|
|
<div id="facets" style="float:left;width:300px;">
|
|
<h3 style="margin-top:0px">categories</h3>
|
|
<div id="categories"></div>
|
|
</div>
|
|
<div id="result" style="margin-left:300px;"></div>
|
|
</body>
|
|
</html>
|