# Query regarding similarity search

**URL:** https://forum.weaviate.io/t/query-regarding-similarity-search/351
**Category:** Support
**Created:** [July 11, 2023, 10:04am UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351 "2023-07-11T10:04:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Sriparna](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@Sriparna](https://forum.weaviate.io/u/Sriparna)
#### Post date: [July 11, 2023, 10:04am UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/1 "2023-07-11T10:04:55Z")

</div>

I have a column in my schema which stores email message content in different languages. If I try a similarity search on this schema, will it return the similar objects irrespective of the language by understanding the context of the email message?  
My expected output would be array of messages in different languages with same context.

Will it work?

---

<div class="post-metadata">

### Author: ![Sriparna](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@Sriparna](https://forum.weaviate.io/u/Sriparna)
#### Post date: [July 17, 2023, 6:43am UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/2 "2023-07-17T06:43:01Z")

</div>

Can someone please assist with my query?  
Thanks in advance.

---

<div class="post-metadata">

### Author: ![jphwang](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jphwang/32/38_2.png) [@jphwang](https://forum.weaviate.io/u/jphwang)
#### Post date: [July 17, 2023, 4:26pm UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/3 "2023-07-17T16:26:24Z")

</div>

Hi @Sriparna (I’ve moved this to support from general).

Yes, this is possible. For this to work, your embedding model would have to be able to understand these different languages.

One model that you can do this with is Cohere’s multilingual model:

> **[text2vec-cohere | Weaviate - vector database](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-cohere#available-models)**
>
> In short

From experience I believe OpenAI’s ada-002 is also somewhat multi-lingual, but it’s not explicitly trained for that purpose as far as I know.

So I recommend starting with the Cohere module and multilingual model in this case.

---

<div class="post-metadata">

### Author: ![Sriparna](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@Sriparna](https://forum.weaviate.io/u/Sriparna)
#### Post date: [July 18, 2023, 5:38am UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/4 "2023-07-18T05:38:18Z")

</div>

Thanks @jphwang . Just reconfirming, I am using the default text2vec-transformer for vectorization of my column. So it will not be able understand the context if the language is not in english for every email content right?

---

<div class="post-metadata">

### Author: ![jphwang](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jphwang/32/38_2.png) [@jphwang](https://forum.weaviate.io/u/jphwang)
#### Post date: [July 18, 2023, 9:11am UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/5 "2023-07-18T09:11:55Z")

</div>

Hi @Sriparna - if you are using text2vec-transformers, you could try one of the multilingual models available.

You can for example try `paraphrase-multilingual-MiniLM-L12-v2`:

> **[text2vec-transformers | Weaviate - vector database](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-transformers#pre-built-images)**
>
> Introduction

---

<div class="post-metadata">

### Author: ![Sriparna](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@Sriparna](https://forum.weaviate.io/u/Sriparna)
#### Post date: [July 18, 2023, 9:38am UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/6 "2023-07-18T09:38:45Z")

</div>

Thanks for clarifying @jphwang . Really appreciate your quick help with my queries. So currently my docker-compose file looks like this :

version: ‘3.4’  
services:  
weaviate:  
image: semitechnologies/weaviate:1.19.6  
restart: on-failure  
ports:  
- “8080:8080”  
environment:  
QUERY\_DEFAULTS\_LIMIT: 25  
AUTHENTICATION\_ANONYMOUS\_ACCESS\_ENABLED: ‘true’  
PERSISTENCE\_DATA\_PATH: “./data”  
DEFAULT\_VECTORIZER\_MODULE: text2vec-transformers  
ENABLE\_MODULES: ‘text2vec-transformers, text2vec-openai,generative-openai’  
TRANSFORMERS\_INFERENCE\_API: [http://t2v-transformers:8080](http://t2v-transformers:8080)  
CLUSTER\_HOSTNAME: ‘node1’  
t2v-transformers:  
image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-MiniLM-L6-v2  
environment:  
ENABLE\_CUDA: 0 # set to 1 to enable  
# NVIDIA\_VISIBLE\_DEVICES: all # enable if running with CUDA

Here is my sample schema creation code

class\_obj = {  
“class”: “Product”,  
“description”: “Product Schema”  
“properties”: [  
{  
“dataType”: [“text”],  
“description”: “prodName”,  
“name”: “prodName”,  
“moduleConfig”: {  
“text2vec-transformers”: {  
“skip”: “false”,  
“vectorizePropertyName”: “false”  
}  
}  
},  
{  
“dataType”: [“text”],  
“description”: “prodDesc”,  
“name”: “prodDesc”,  
“moduleConfig”: {  
“text2vec-transformers”: {  
“skip”: “false”,  
“vectorizePropertyName”: “false”  
}  
}  
},  
],  
“vectorizer”: “text2vec-transformers”  
}

Now if I want to use paraphrase-multilingual-MiniLM-L12-v2 model then I just need to change my docker-compose.yml file as below and no change is required in my schema creation code right? Or do I have to specify this model name in my schema creation code somewhere as well?

version: ‘3.4’  
services:  
weaviate:  
image: semitechnologies/weaviate:1.19.6  
restart: on-failure  
ports:  
- “8080:8080”  
environment:  
QUERY\_DEFAULTS\_LIMIT: 25  
AUTHENTICATION\_ANONYMOUS\_ACCESS\_ENABLED: ‘true’  
PERSISTENCE\_DATA\_PATH: “./data”  
DEFAULT\_VECTORIZER\_MODULE: text2vec-transformers  
ENABLE\_MODULES: ‘text2vec-transformers, text2vec-openai,generative-openai’  
TRANSFORMERS\_INFERENCE\_API: [http://t2v-transformers:8080](http://t2v-transformers:8080)  
CLUSTER\_HOSTNAME: ‘node1’  
t2v-transformers:  
image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-multilingual-MiniLM-L12-v2  
environment:  
ENABLE\_CUDA: 0 # set to 1 to enable  
# NVIDIA\_VISIBLE\_DEVICES: all # enable if running with CUDA

---

<div class="post-metadata">

### Author: ![jphwang](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jphwang/32/38_2.png) [@jphwang](https://forum.weaviate.io/u/jphwang)
#### Post date: [July 18, 2023, 12:53pm UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/7 "2023-07-18T12:53:39Z")

</div>

Yup. To set the image (model) to be used, you just need to set it in the config file as shown here.

> **[text2vec-transformers | Weaviate - vector database](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-transformers#option-1-use-a-pre-built-transformer-model-container)**
>
> Introduction

And you will have to re-vectorize your data, of course.

Cheers,  
JP

---

<div class="post-metadata">

### Author: ![Sriparna](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@Sriparna](https://forum.weaviate.io/u/Sriparna)
#### Post date: [July 18, 2023, 1:14pm UTC](https://forum.weaviate.io/t/query-regarding-similarity-search/351/8 "2023-07-18T13:14:51Z")

</div>

Got it. Thanks a lot !
