FacetView

FacetView 是 ElasticSearch 的一个纯 javascript 前端。「FacetView is a pure javascript frontend for ElasticSearch.」

  • 所有者: rufuspollock-okfn/facetview
  • 平台: Web browsers
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

FacetView_ is a pure javascript frontend for ElasticSearch search
indices.

Facetview2

A more modular codebase is available at https://github.com/CottageLabs/facetview2

Old facetview docs below

(This used to work against SOLR too, but the need to maintain support for that became less, and is now not a priority. So has been removed altogether. If anyone needs it, it could be added back in by writing an alternative to the elasticsearchquery() with a solrsearchquery(), and making sure the returned resultset can be parsed out properly. Used to work fine so it can be done, but as new functionality like nesting and so on was brought in, it became less important.)

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

.. _FacetView: http://okfnlabs.org/facetview/

Development of this version is NOT currently active. Facetview1 repo: http://github.com/okfn/facetview

Demo

See http://okfnlabs.org/facetview/ or if you have the source just take a look
at index.html or simple.html

Status

FacetView is pretty new, and still under active development but is already
pretty stable. If you have suggestions or want to make a contribution please
check out the github repo.

Using FacetView

Add the following code to your web page::

  • BUT change the src URLs to something sensible depending on where you install
    the files; or something different if you have the files available already.
    If using your own, NOTE the versions; particularly bootstrap - we are on the 2.x
  • d3 scripts can be dropped if you intend to disable filter visualisations.

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

Now that you have everything ready, you will probably want to customize to
get it looking the way you want it.

Customization

Once you have FacetView all ready to go, you should probably do some
customisation. There are a few ways to do this:

Edit the config in jquery.facetview.js

View the config options near the top of the file to learn more. Some
important points:

  • search_url – you need this. Should be an elasticsearch or SOLR query endpoint
  • search_index – your index type, solr or elasticsearch
  • result_display - there is a long example of result display. It is a list of
    lists; each list represents a line; each line contains objects; the objects
    specify the field they should output, and pre and post information to surround
    it with
  • display_images - if this is set to true, then facetview will attempt to find
    the first http://... that ends with .jpg / .jpeg / .png / .gif in each record;
    if one is found, it will be displayed in the search result as a 100 x (up to)
    150 px thumbnail
  • default_url_params – parameters to pass through with every query; should
    include “wt”:”json” for SOLR queries to return JSON, and probably
    “facet.mincount”:1 for SOLR queries to ignore zero counts on facet values
  • predefined_filters – use these to apply some filters that will be appended
    to every search. For example, customise a facetview display to only show
    records with a particular owner / collection / tag / whatever

Pass in config settings when calling FacetView

All of the settings can also be defined when calling FacetView, and will
overwrite the values set in the file itself. So you can do something like
this::

Passing config parameters in the URL

Configs can be passed on the URL as query parameters. For example,
?q=blah will set the starting search to "blah". You can add complex
queries as JSON objects, such as ?paging={"size":20,"from":10}. Nice...

Providing the location of an external config file

A file can be made available anywhere on the web (depending, keep reading)
with any of the above listed settings in it (written in the usual way for a
JSON object). Then, just pass the URL of your config file when you call
FacetView - as a parameter called "config_file", and it will attempt to read
that config file for you.

The first attempt will make a JSONP request to the URL you specify, so if your
file is properly set up on a server that enables it to respond to such a request,
you can make these calls to any address on the internet.

If JSONP call fails, then a normal GET will be executed. So if the file is under
the same domain, it should be retrievable. In this case, the file must be
normally readable to a GET request - e.g. it should have a .html extension, or
be otherwise set up to return your config as a string to the GET request. The
JSON config object is then parsed and read in.

Config precedence

When you introduce a new config object, they are merged into earlier configs with
overwrite. So any config you specify in facetview.jquery.js will be overwritten
and appended with newer info from any config passed in when calling facetview,
which is overwritten by config parameters passed in the URL,
and a call to a remote config file will similarly overwrite and append to all
previous.

Change the layout by making and using a custom CSS file

Facetview uses the latest twitter bootstrap_. When you embed facetview in a page,
you need to include the calls to bootstrap js and css files (see the example
index.html here for more info). You could restyle facetview any way you want,
either with or without bootstrap - although it would be a hassle to strip
bootstrap out; recommend working with or around it.

Copyright and License

Copyright 2011 Open Knowledge Foundation and Cottage Labs.

Licensed under the MIT License_

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

主要指標

概覽
名稱與所有者rufuspollock-okfn/facetview
主編程語言JavaScript
編程語言CSS (語言數: 3)
平台Web browsers
許可證
所有者活动
創建於2011-08-22 09:52:50
推送於2015-05-14 11:46:16
最后一次提交2015-05-14 12:46:12
發布數0
用户参与
星數291
關注者數53
派生數91
提交數104
已啟用問題?
問題數33
打開的問題數11
拉請求數6
打開的拉請求數2
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?