This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Matt-Mitchells-MacBook-Pro:solrland mattmitchell$ lein swank | |
Exception in thread "main" java.lang.Exception: No such var: version/abbrev (project.clj:3) | |
at clojure.lang.Compiler.analyze(Compiler.java:5205) | |
at clojure.lang.Compiler.analyze(Compiler.java:5151) | |
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3036) | |
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5371) | |
at clojure.lang.Compiler.analyze(Compiler.java:5190) | |
at clojure.lang.Compiler.analyze(Compiler.java:5151) | |
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3057) | |
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5371) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:docs [{:name "Boston" :lat 0 :lng 0}] | |
:facets {:property-types [{:name "xxx" :code "xxx" :num-hotels 0}]} | |
:stats {:stars {:min 0 ...}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn ok? [x] | |
(expect x => (contains {:id number?}))) | |
(fact | |
[{:id 0} {:id 3}] => (has every? ok?)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn string-or-nil? [x] (or (string? x) (nil? x))) | |
hotel => (contains {:lat number? :lng number? :name string? | |
:address (contains {:line1 string-or-nil? | |
:line2 string-or-nil? | |
:city string? | |
:region string? | |
:postal_code string? | |
:country_code string? | |
:country_name string?}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; calling this: | |
(def-field [:data] (str "hello!")) | |
;; creates this: | |
{:fields [:data] :builder `(clojure.core/str "hello!")} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def servers {}) | |
(def default-core :production) | |
(defmacro with-server | |
"Execute body with the *server* binding set" | |
([body] (with-server default-core body)) | |
([server-name & body] | |
`(binding [*server* (~server-name *servers*)] | |
~@body))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Debugger entered--Lisp error: (end-of-file) | |
byte-code("\302\300\"\210\303 \304\"\210\300\305\"\207" [error process debug slime-net-close t "net-read error: %S"] 3) | |
slime-net-read-or-lose(#<process SLIME Lisp>) | |
slime-process-available-input(#<process SLIME Lisp>) | |
slime-net-filter(#<process SLIME Lisp> " University of Virginia and Rotunda. Features. Courtyard by Marriott Charlottesville North has a...\\\", :h_lat 38.07323, :id \\\"hotel 0tOlou5mT04rGcJ002f129iS\\\", :h_location_tid \\\"1LTobQ5UP04rBth002f129iS\\\"}}, :facets ()}\") 12)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solr = RSolr.connect(:timeout => 60, :url => "http://localhost:8983/solr") | |
module RSolr4Duncan | |
def build_request path, opts | |
super path, opts.merge(:method => :post) | |
end | |
def send_and_receive path, opts | |
super rescue {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] | |
\000-\031]+(?:(?:(?:\r\n)?[ \t] | |
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ | |
\t]))*"(?:(?: \r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ | |
\t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:( ?:\r\n)?[ | |
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ | |
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] | |
\000-\0 31]+(?:(?:(?:\r\n)?[ | |
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\ | |
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn parse-de-normalized-list [items] | |
(let [r #"^.+::.+$" | |
reducer (fn [prod item] | |
(if-not (re-find r (:code item)) | |
(let [child-r (re-pattern (str "^" (:code item) "::.+$")) | |
children (filter #(re-find child-r (:code %1)) items) | |
new-item (merge item {:children (vec children)})] | |
(merge prod new-item)) | |
prod))] | |
(reduce reducer [] items))) |