Correctly distinguish between fulltext-values and fulltext-datoms.

This commit is contained in:
Richard Newman 2016-08-29 16:08:15 -07:00
parent a9b26f154a
commit 31e354ae61
3 changed files with 12 additions and 4 deletions

View file

@ -160,7 +160,8 @@
(source/map->DatomsSource
{:table :datoms
:schema (:schema db)
:fulltext-table :fulltext_values
:fulltext-table :fulltext_datoms
:fulltext-values :fulltext_values
:fulltext-view :all_datoms
:columns [:e :a :v :tx :added]
:attribute-transform (partial datoms-attribute-transform db)

View file

@ -102,8 +102,8 @@
;; Find the FTS table name and alias. We might have multiple fulltext
;; expressions so we will generate a query like
;; SELECT ttt.a FROM t1 AS ttt WHERE ttt.t1 MATCH 'string'
[fulltext-table fulltext-alias] (source/source->fulltext-from (:source cc)) ; [:t1 :ttt]
match-column (sql/qualify fulltext-alias fulltext-table) ; :ttt.t1
[fulltext-table fulltext-alias] (source/source->fulltext-values (:source cc)) ; [:t1 :ttt]
match-column (sql/qualify fulltext-alias fulltext-table) ; :ttt.t1
match-value (cc/argument->value cc search)
[datom-table datom-alias] (source/source->non-fulltext-from (:source cc))

View file

@ -40,6 +40,8 @@
(source->non-fulltext-from [source])
(source->fulltext-from [source]
"Returns a pair, `[table alias]` for querying the source's fulltext index.")
(source->fulltext-values [source]
"Returns a pair, `[table alias]` for querying the source's fulltext values")
(source->constraints [source alias])
(pattern->schema-value-type [source pattern])
(attribute-in-source [source attribute])
@ -48,8 +50,9 @@
(defrecord
DatomsSource
[table ; Typically :datoms.
fulltext-table ; Typically :fulltext_values
fulltext-table ; Typically :fulltext_datoms
fulltext-view ; Typically :all_datoms
fulltext-values ; Typically :fulltext_values
columns ; e.g., [:e :a :v :tx]
schema ; An ISchema instance.
@ -104,6 +107,10 @@
(let [table (:fulltext-table source)]
[table ((:table-alias source) table)]))
(source->fulltext-values [source]
(let [table (:fulltext-values source)]
[table ((:table-alias source) table)]))
(source->constraints [source alias]
(when-let [f (:make-constraints source)]
(f alias)))