Synonym Search example using GraphQL query

Description

Can you please provide an example GraphQL query for synonym search in weaviate. I wanted to know the vectorizers that can be used.

My example is simple as below:

When a user search for ‘phone’, he has to see results such Mobile, smartphones, ‘call’ etc…

Thanks for the Help in Advance!!!

Server Setup Information

  • Weaviate Server Version:
  • Deployment Method:
  • Multi Node? Number of Running Nodes:
  • Client Language and Version:
  • Multitenancy?:

Any additional Information

Hi @Praveenkasani, how are you doing?

You can use a basic hybrid search example like this:

{
Get {
JeopardyQuestion(
limit: 3
hybrid: {
query: “food”
}
) {
question
answer
}
}
}

Or a more advanced example with additional control:

{
Get {
JeopardyQuestion(
limit: 3
hybrid: {
query: “food”
properties: [“question^2”, “answer”]
alpha: 0.25
}
) {
question
answer
}
}
}

Have you seen Hybrid search documentation? it will help you greatly for this.

Regards,
Mohamed Shahin,
Weaviate Support

1 Like

Hi Shahnin,

Thanks for the reply, I will go through the queries and Hybrid search documentation.

Regards,
Praveen

1 Like

Hi Shahnin,

I tried with the above query but looks like search is happening on all fields in my dictionary.

Below is my hybrid query and under the property I have only question and answers but the results are fetched with respect to subjects or topics also i.e. ‘Car’ word doesn’t exist in question or answers but exist in subjects/topics.

Can you help me with the exact synonym search query on the select fields i.e. I should query only on question & answer fields but should be able to retrieve all other fields of that document.

Also, Please provide the modules that can be used for synonym’s. As of now we are using the below modules for our dictionary:


Thanks in Advance!!!

{
Get {
MyDictionary_1(
where: {
operator: And,
operands: [
{ path: [“attribute3”],
operator: Equal,
valueString: “abcd”
}
{ path: [“attribute1”],
operator: Equal,
valueString: “xyz”
}
{ path: [“attribute2”],
operator: Equal,
valueString: “subject”
}
]
}
hybrid: {
query:“car”,
properties: [“question”, “answers”]
alpha:0.25
}
limit:100
) {
answers
question
subjects
topics

}

}
}

Hi @Praveenkasani,

I’m not familiar with your schema; the example I shared was a general one to illustrate how to structure a hybrid search. Could you share your schema with me?

Additionally, regarding the modules you’re referring to, are you using OpenAI, Google Palm, or Cohere APIs for vectorization? Weaviate can integrate with these providers to leverage their capabilities.

Have you seen this guide if you are using our Cloud services?

Regards,
Mohamed Shahin
Weaviate Support