FacetView2

一个纯 javascript 的 ElasticSearch 搜索索引前端。「a pure javascript frontend for ElasticSearch search indices.」

Github星跟踪图

FacetView2

一个纯 javascript 的 ElasticSearch 搜索索引前端。

它是作为一个 jQuery 插件开发的,可以让你轻松地将一个分面浏览前端嵌入到任何网页中。

FacetView2 是对原 FacetView 应用的重大重写。参见 https://github.com/okfn/facetview 了解以前的版本。

使用 FacetView2

在您的网页上添加以下代码:

<script type="text/javascript" src="vendor/jquery/1.7.1/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="vendor/bootstrap/js/bootstrap.min.js"></script>  
<link rel="stylesheet" href="vendor/jquery-ui-1.8.18.custom/jquery-ui-1.8.18.custom.css">
<script type="text/javascript" src="vendor/jquery-ui-1.8.18.custom/jquery-ui-1.8.18.custom.min.js"></script>

<script type="text/javascript" src="es.js"></script>
<script type="text/javascript" src="bootstrap2.facetview.theme.js"></script>
<script type="text/javascript" src="jquery.facetview2.js"></script>
<link rel="stylesheet" href="css/facetview.css">

然后在页面的某个地方添加一个脚本,在特定的页面元素上实际调用并设置 facetview:

<script type="text/javascript">
jQuery(document).ready(function($) {
  $('.facet-view-simple').facetview({
    search_url: 'http://localhost:9200/myindex/type/_search',
    facets: [
        {'field': 'publisher.exact', 'size': 100, 'order':'term', 'display': 'Publisher'},
        {'field': 'author.name.exact', 'display': 'author'},
        {'field': 'year.exact', 'display': 'year'}
    ],
  });
});
</script>

定制化

FacetView2 已经被编写成允许在一个灵活但受限的页面框架内进行广泛的定制。

这里会有更多的文档来介绍如何做到这一点,但在这段时间里,可以看看 jquery.facetview.js 的源码,看看配置选项和模板,可以替换为自定义显示。

版权和许可

Copyright 2014 Cottage Labs.

根据 MIT 许可证授权

twitter bootstrap: http://twitter.github.com/bootstrap/ MIT License: http://www.opensource.org/licenses/mit-license.php


主要指标

概览
名称与所有者CottageLabs/facetview2
主编程语言JavaScript
编程语言CSS (语言数: 3)
平台Web browsers
许可证MIT License
所有者活动
创建于2014-06-18 06:15:52
推送于2018-03-08 14:39:06
最后一次提交2017-04-18 15:22:25
发布数0
用户参与
星数80
关注者数13
派生数31
提交数75
已启用问题?
问题数15
打开的问题数9
拉请求数4
打开的拉请求数0
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

FacetView2

a pure javascript frontend for ElasticSearch search indices.

It has been developed as a jQuery plugin and lets you easily embed a faceted browse front end into any web page.

FacetView2 is a major re-write of the original FacetView application. See https://github.com/okfn/facetview for the previous version.

Using FacetView2

Add the following code to your web page:

<script type="text/javascript" src="vendor/jquery/1.7.1/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="vendor/bootstrap/js/bootstrap.min.js"></script>  
<link rel="stylesheet" href="vendor/jquery-ui-1.8.18.custom/jquery-ui-1.8.18.custom.css">
<script type="text/javascript" src="vendor/jquery-ui-1.8.18.custom/jquery-ui-1.8.18.custom.min.js"></script>

<script type="text/javascript" src="es.js"></script>
<script type="text/javascript" src="bootstrap2.facetview.theme.js"></script>
<script type="text/javascript" src="jquery.facetview2.js"></script>
<link rel="stylesheet" href="css/facetview.css">

Then add a script somewhere to your page that actually calls and sets up the facetview on a particular page element:

<script type="text/javascript">
jQuery(document).ready(function($) {
  $('.facet-view-simple').facetview({
    search_url: 'http://localhost:9200/myindex/type/_search',
    facets: [
        {'field': 'publisher.exact', 'size': 100, 'order':'term', 'display': 'Publisher'},
        {'field': 'author.name.exact', 'display': 'author'},
        {'field': 'year.exact', 'display': 'year'}
    ],
  });
});
</script>

Customisation

FacetView2 has been written to allow extensive customisation within a flexible but constrained page framework.

There will be more documentation here on how to do that, but in the mean time, take a look at the source of jquery.facetview.js for the config options and templates that can be replaced for custom display.

Copyright and License

Copyright 2014 Cottage Labs.

Licensed under the MIT Licence

twitter bootstrap: http://twitter.github.com/bootstrap/
MIT License: http://www.opensource.org/licenses/mit-license.php