Navigation Menu

Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Commit

Permalink
Made code a bit more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
robconery committed Aug 17, 2015
1 parent 8283203 commit fb3b210
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 3 deletions.
177 changes: 177 additions & 0 deletions docs/css/custom.css
@@ -0,0 +1,177 @@
code, pre {
font-family: monaco, Consolas,monospace;
font-size: 13px;
line-height: 1.6;
padding: 0;
border-radius: 6px;
background-color: #333333;
color: white;
padding: 4px;
}
pre > code {
background-color: #333333;
border-color: #333333;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 1.33rem 1.7689rem;
color: white;
line-height: 1.4;
width: 100%;
display: block;
white-space: pre;
overflow: auto;
border-radius: 6px;
}
/**
* Obsidian style
* ported by Alexander Marenin (http://github.com/ioncreature)
*/

.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #282b2e;
-webkit-text-size-adjust: none;
}

.hljs-keyword,
.hljs-literal,
.hljs-change,
.hljs-winutils,
.hljs-flow,
.nginx .hljs-title,
.css .hljs-id,
.tex .hljs-special {
color: #93c763;
}

.hljs-number {
color: #ffcd22;
}

.hljs {
color: #e0e2e4;
}

.css .hljs-tag,
.css .hljs-pseudo {
color: #d0d2b5;
}

.hljs-attribute,
.hljs .hljs-constant {
color: #668bb0;
}

.xml .hljs-attribute {
color: #b3b689;
}

.xml .hljs-tag .hljs-value {
color: #e8e2b7;
}

.hljs-code,
.hljs-class .hljs-title,
.hljs-header {
color: white;
}

.hljs-class,
.hljs-hexcolor {
color: #93c763;
}

.hljs-regexp {
color: #d39745;
}

.hljs-at_rule,
.hljs-at_rule .hljs-keyword {
color: #a082bd;
}

.hljs-doctype {
color: #557182;
}

.hljs-link_url,
.hljs-tag,
.hljs-tag .hljs-title,
.hljs-bullet,
.hljs-subst,
.hljs-emphasis,
.hljs-type,
.hljs-preprocessor,
.hljs-pragma,
.ruby .hljs-class .hljs-parent,
.hljs-built_in,
.django .hljs-template_tag,
.django .hljs-variable,
.smalltalk .hljs-class,
.django .hljs-filter .hljs-argument,
.smalltalk .hljs-localvars,
.smalltalk .hljs-array,
.hljs-attr_selector,
.hljs-pseudo,
.hljs-addition,
.hljs-stream,
.hljs-envvar,
.apache .hljs-tag,
.apache .hljs-cbracket,
.tex .hljs-command,
.hljs-prompt,
.hljs-name {
color: #8cbbad;
}

.hljs-string {
color: #ec7600;
}

.hljs-comment,
.hljs-annotation,
.hljs-blockquote,
.hljs-horizontal_rule,
.hljs-decorator,
.hljs-pi,
.hljs-deletion,
.hljs-shebang,
.apache .hljs-sqbracket,
.tex .hljs-formula {
color: #818e96;
}

.hljs-keyword,
.hljs-literal,
.css .hljs-id,
.hljs-doctag,
.hljs-title,
.hljs-header,
.hljs-type,
.vbscript .hljs-built_in,
.rsl .hljs-built_in,
.smalltalk .hljs-class,
.diff .hljs-header,
.hljs-chunk,
.hljs-winutils,
.bash .hljs-variable,
.apache .hljs-tag,
.tex .hljs-special,
.hljs-request,
.hljs-at_rule .hljs-keyword,
.hljs-status {
font-weight: normal;
}

.coffeescript .javascript,
.javascript .xml,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
opacity: 0.5;
}
19 changes: 16 additions & 3 deletions docs/document_queries.md
Expand Up @@ -20,14 +20,14 @@ Massive does two things here:
The table it creates looks like this:

```sql
create table %s(
create table doggies(
id serial primary key,
body jsonb not null,
search tsvector,
created_at timestamptz default now()
);
create index idx_%s on %s using GIN(body jsonb_path_ops);
create index idx_%s_search on %s using GIN(search);
create index idx_doggies on doggies using GIN(body jsonb_path_ops);
create index idx_doggies_search on doggies using GIN(search);
```

Notice that Massive also creates a GIN index on the body column as well as a `search` field. You can use this to your advantage to make querying documents much, much easier. We're indexing that search field too! All your data will be stored in the `body` column.
Expand Down Expand Up @@ -106,6 +106,19 @@ where body -> 'name' @> 'Fido';

This query will take full advantage of our index.

## Full Text Queries

You can execute Full Text queries on the fly with Massive:

```js
db.doggies.searchDoc({
keys : ["name", "owner"],
term : "Rusty"
}, function(err, docs){
//matching docs returned
});
```

## A Word About ID and Documents

We need to give every row in our document table a primary key - this is still a relational system. So, for that, we use a serial integer which should work for most people 99.99% of the time.
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Expand Up @@ -4,6 +4,8 @@ repo_url: https://github.com/robconery/massive-js
site_favicon: favicon.ico
site_url: http://massive-js.readthedocs.org
theme: readthedocs
extra_css:
- css/custom.css
pages:
- Home : index.md
- Installation and Quick Start : quick_start.md
Expand Down

0 comments on commit fb3b210

Please sign in to comment.