Git Product home page Git Product logo

Comments (6)

cch123 avatar cch123 commented on August 30, 2024

目前暂时还不支持

这个好像写 sql 的时候没有相同语义的符号。。要是用其它的也挺奇怪的,目前依赖的这个 sql parser 里定义的条件表达式可以参考 这里

我初步想法是扩展一下加个自定义函数?

这里的 switch 下面加一个 *sqlparser.FuncExpr 的 case,然后写类似这种的 SQL:

select * from aaa
where a=1 
and multi_match(b, 'yes we can')

需要看看你们的具体需求

from elasticsql.

fengweiqiang avatar fengweiqiang commented on August 30, 2024

嗯,谢谢,还有就是查询字段null/not null 没实现,是因为版本不兼容吗?

from elasticsql.

cch123 avatar cch123 commented on August 30, 2024

@fengweiqiang ,我们当时没这个需求,因为 es 里的数据都是从 mysql 来的,而 mysql 的规范都会要求字段不为 null

from elasticsql.

fengweiqiang avatar fengweiqiang commented on August 30, 2024

嗯嗯,非常感想你的讲解

from elasticsql.

cch123 avatar cch123 commented on August 30, 2024

@fengweiqiang ,在这个分支上已经支持了,你那边测测吧,要是没问题,我合 master:

https://github.com/cch123/elasticsql/tree/feature_multi_match

package main

import (
    "fmt"

    "github.com/cch123/elasticsql"
)

var sql = `
select * from aaa
where a=1 and x = '三个男人'
and multi_match(query='this is a test', fields=(title,title.origin))
`
//and multi_match(query='this is a test', fields=(title,title.origin), type=phrase)

func main() {
    dsl, esType, err := elasticsql.Convert(sql)
    fmt.Println(dsl)
    fmt.Println(esType)
    fmt.Println(err)
}

可以提供 query、fields 或者 query、fields 和 type

from elasticsql.

cch123 avatar cch123 commented on August 30, 2024

我自己简单试了试没啥问题,#20
之后有问题可以 reopen 或者另开 issue

from elasticsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.