FacetView2

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

  • Owner: CottageLabs/facetview2
  • Platform: Web browsers
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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


Main metrics

Overview
Name With OwnerCottageLabs/facetview2
Primary LanguageJavaScript
Program languageCSS (Language Count: 3)
PlatformWeb browsers
License:MIT License
所有者活动
Created At2014-06-17 22:15:52
Pushed At2018-03-08 06:39:06
Last Commit At2017-04-18 08:22:25
Release Count0
用户参与
Stargazers Count80
Watchers Count15
Fork Count31
Commits Count75
Has Issues Enabled
Issues Count15
Issue Open Count9
Pull Requests Count4
Pull Requests Open Count0
Pull Requests Close Count3
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

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