Restream / reindexer

Embeddable, in-memory, document-oriented database with a high-level Query builder interface.
https://reindexer.io
Apache License 2.0
763 stars 64 forks source link

Incorrect work of full-text search when using synonym with an extra word #64

Open ilyamaksimov1991 opened 3 years ago

ilyamaksimov1991 commented 3 years ago

We have 3 products with the name: 1.защитное стекло для экрана samsung galaxy 2.защитное стекло для экрана apple iphone 3.защитное стекло для экрана xiaomi • we have a synonym "бронестекло => защитное стекло" upon request SELECT , COUNT() FROM products WHERE search_products = '@name +бронестекло' I get all 3 items. But if I add another word, there will be errors: SELECT , COUNT() FROM products WHERE search_products = '@name +бронестекло +iphone' I expect to get only the second product, but I get all three. SELECT , COUNT() FROM products WHERE search_products = '@name +бронестекло +samsung' I expect to see only the first product, but displays all three products SELECT , COUNT() FROM products WHERE search_products = '@name +бронестекло +xiaomi' I expect only the third product, but displays all three. SELECT , COUNT() FROM products WHERE search_products = '@name +бронестекло +something +not +in +the +title' I expect a blank search, but all three products are displayed

type Product struct { Id string reindex:"id" json:"id" SpaceId string reindex:"space_id" json:"spaceid" Name string reindex:"name,tree" json:"name" struct{} reindex:"name+brand=searchproducts,text,composite" struct{} reindex:"id+space_id,,composite,pk" } products := []Product{ { Id: "1", SpaceId: "msk_cl", Name: "защитное стекло для экрана samsung galaxy", }, { Id: "2", SpaceId: "msk_cl", Name: "защитное стекло для экрана apple iphone", }, { Id: "3", SpaceId: "msk_cl", Name: "защитное стекло для экрана xiaomi", }, }

ilyamaksimov1991 commented 3 years ago

thanks for the solved problem, but there are new problems with multi-word synonyms

https://github.com/Restream/reindexer/issues/68