aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid 'arrdem' McKenzie <reid@factual.com>2015-08-12 16:05:49 -0700
committerReid 'arrdem' McKenzie <reid@factual.com>2015-08-12 16:05:49 -0700
commit66630e326e488cd77d21151bc6cba31852b1b053 (patch)
tree65f8ac6d46e4626e38846da93e30d85780a452f2
parente3dd7be43143ef99271e108665d46e5534c19aa0 (diff)
downloadclucy-66630e326e488cd77d21151bc6cba31852b1b053.tar.gz
clucy-66630e326e488cd77d21151bc6cba31852b1b053.tar.xz
clucy-66630e326e488cd77d21151bc6cba31852b1b053.zip
Lift subexpr
-rw-r--r--src/clucy/core.clj27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/clucy/core.clj b/src/clucy/core.clj
index 17d6a54..3bcbd8a 100644
--- a/src/clucy/core.clj
+++ b/src/clucy/core.clj
@@ -57,21 +57,24 @@
:analyzed - when :indexed is enabled use this option to disable/eneble Analyzer for current field.
:norms - when :indexed is enabled user this option to disable/enable the storing of norms."
([document key value]
- (add-field document key value {}))
+ (add-field document key value {}))
([document key value meta-map]
+ (let [stored? (if (false? (:stored meta-map))
+ Field$Store/NO
+ Field$Store/YES)
+ how-indexed (if (false? (:indexed meta-map))
+ Field$Index/NO
+ (case [(false? (:analyzed meta-map)) (false? (:norms meta-map))]
+ [false false] Field$Index/ANALYZED
+ [true false] Field$Index/NOT_ANALYZED
+ [false true] Field$Index/ANALYZED_NO_NORMS
+ [true true] Field$Index/NOT_ANALYZED_NO_NORMS))]
(.add ^Document document
- (Field. (as-str key) (as-str value)
- (if (false? (:stored meta-map))
- Field$Store/NO
- Field$Store/YES)
- (if (false? (:indexed meta-map))
- Field$Index/NO
- (case [(false? (:analyzed meta-map)) (false? (:norms meta-map))]
- [false false] Field$Index/ANALYZED
- [true false] Field$Index/NOT_ANALYZED
- [false true] Field$Index/ANALYZED_NO_NORMS
- [true true] Field$Index/NOT_ANALYZED_NO_NORMS))))))
+ (Field. ^String (as-str key)
+ ^String (as-str value)
+ ^Field$Store stored?
+ ^Field$Index how-indexed)))))
(defn- map-stored
"Returns a hash-map containing all of the values in the map that