Correctly distinguish between fulltext-values and fulltext-datoms.
This commit is contained in:
parent
a9b26f154a
commit
31e354ae61
3 changed files with 12 additions and 4 deletions
|
@ -160,7 +160,8 @@
|
||||||
(source/map->DatomsSource
|
(source/map->DatomsSource
|
||||||
{:table :datoms
|
{:table :datoms
|
||||||
:schema (:schema db)
|
:schema (:schema db)
|
||||||
:fulltext-table :fulltext_values
|
:fulltext-table :fulltext_datoms
|
||||||
|
:fulltext-values :fulltext_values
|
||||||
:fulltext-view :all_datoms
|
:fulltext-view :all_datoms
|
||||||
:columns [:e :a :v :tx :added]
|
:columns [:e :a :v :tx :added]
|
||||||
:attribute-transform (partial datoms-attribute-transform db)
|
:attribute-transform (partial datoms-attribute-transform db)
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
;; Find the FTS table name and alias. We might have multiple fulltext
|
;; Find the FTS table name and alias. We might have multiple fulltext
|
||||||
;; expressions so we will generate a query like
|
;; expressions so we will generate a query like
|
||||||
;; SELECT ttt.a FROM t1 AS ttt WHERE ttt.t1 MATCH 'string'
|
;; SELECT ttt.a FROM t1 AS ttt WHERE ttt.t1 MATCH 'string'
|
||||||
[fulltext-table fulltext-alias] (source/source->fulltext-from (:source cc)) ; [:t1 :ttt]
|
[fulltext-table fulltext-alias] (source/source->fulltext-values (:source cc)) ; [:t1 :ttt]
|
||||||
match-column (sql/qualify fulltext-alias fulltext-table) ; :ttt.t1
|
match-column (sql/qualify fulltext-alias fulltext-table) ; :ttt.t1
|
||||||
match-value (cc/argument->value cc search)
|
match-value (cc/argument->value cc search)
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
(source->non-fulltext-from [source])
|
(source->non-fulltext-from [source])
|
||||||
(source->fulltext-from [source]
|
(source->fulltext-from [source]
|
||||||
"Returns a pair, `[table alias]` for querying the source's fulltext index.")
|
"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])
|
(source->constraints [source alias])
|
||||||
(pattern->schema-value-type [source pattern])
|
(pattern->schema-value-type [source pattern])
|
||||||
(attribute-in-source [source attribute])
|
(attribute-in-source [source attribute])
|
||||||
|
@ -48,8 +50,9 @@
|
||||||
(defrecord
|
(defrecord
|
||||||
DatomsSource
|
DatomsSource
|
||||||
[table ; Typically :datoms.
|
[table ; Typically :datoms.
|
||||||
fulltext-table ; Typically :fulltext_values
|
fulltext-table ; Typically :fulltext_datoms
|
||||||
fulltext-view ; Typically :all_datoms
|
fulltext-view ; Typically :all_datoms
|
||||||
|
fulltext-values ; Typically :fulltext_values
|
||||||
columns ; e.g., [:e :a :v :tx]
|
columns ; e.g., [:e :a :v :tx]
|
||||||
schema ; An ISchema instance.
|
schema ; An ISchema instance.
|
||||||
|
|
||||||
|
@ -104,6 +107,10 @@
|
||||||
(let [table (:fulltext-table source)]
|
(let [table (:fulltext-table source)]
|
||||||
[table ((:table-alias source) table)]))
|
[table ((:table-alias source) table)]))
|
||||||
|
|
||||||
|
(source->fulltext-values [source]
|
||||||
|
(let [table (:fulltext-values source)]
|
||||||
|
[table ((:table-alias source) table)]))
|
||||||
|
|
||||||
(source->constraints [source alias]
|
(source->constraints [source alias]
|
||||||
(when-let [f (:make-constraints source)]
|
(when-let [f (:make-constraints source)]
|
||||||
(f alias)))
|
(f alias)))
|
||||||
|
|
Loading…
Reference in a new issue