🔍 Seeking Assistance with Weaviate Vector Search

Hey there, wonderful community!

I’m currently diving into the fascinating world of Weaviate, and I could use a bit of guidance on optimizing my vector search queries. Here’s a snippet of the properties I’m working with:

properties = {
    "supplier_sku": d["SUPPLIER_SKU"],
    "name": d["NAME"],
    "title": d["TITLE"],
    "description": d["DESCRIPTION"],
    "brand": d["BRAND"],
    "price": float(d["PRICE_GBP"]),
    "cost_price": float(d["COST_PRICE_GBP"]),
    "supplier_name": d["SUPPLIER_NAME"],
    "supplier_country": d["SUPPLIER_COUNTRY"],
    "categories": d["CATEGORIES"],
    "product_type": d["PRODUCT_TYPE"],
    "product_description": d["PRODUCT_SUMMARY"],
    "key_features": d["KEY_FEATURES"],                        
    "keywords": d["KEYWORDS"],
}

What I’m aiming for is to refine my search to focus solely on the “product_description” property. Essentially, I want to perform a vector search on just this field. However, I also need to retrieve all other relevant attributes such as “name,” “title,” “supplier name,” “category,” and so forth for the matched results.

I’ve come across an example in the documentation that performs a similar search across multiple properties:

response = (
    client.query
    .get("Question", ["question", "answer", "category"])
    .with_near_text({"concepts": ["biology"]})
    .with_limit(2)
    .do()
)

How can I exclusively execute a vector search on the “answer” field while obtaining all additional attributes such as “question” and “category” in the response?

Hi Freddy!!

Bear in mind that you are using the python client v3, while we strongly suggest using the v4.

With the v3, you need to specify the fields to be retrieved, while in v4 all properties get returned by default.

Also, whenever you insert an object, the vector will be generated based on the properties and it’s configuration. For example, if you set a property to skip vectorization, it will not be added to the vectorization phase.

This means that whenever you do a near_text search, it will search the vector, that is generated based on your properties, according to your collection schema

There is a new feature called named vectors (check course here) that you can specify a named vector to be generated based solely on one property.

Let me know if this helps.

Thank you, @DudaNogueira, for your prompt replies, which were extremely helpful. I have a few more questions.

If I set skip:true and vectorizePropertyName:“product_description” in the setting below, will the vector search only be performed on the “product_description” property?

How can I specify multiple properties for vectorization? Can I provide a list like [“property1”,“property2”]?

      "moduleConfig": {                     
        "text2vec-contextionary": {
          "skip": true,                     
          "vectorizePropertyName": true,    
        }

Once this setting has been applied, can I still use different search methods such as vector, image, keyword, and hybrid search? It would be great if you could provide clarification on this.

1 Like

hi @Freddy !!

The vectorizePropertyName must receive a boolean. This will indicate if you want to vectorize also the property name while concatenating all the properties values to generate the vector.

If you want to do a vector search only at one specific property, you have two options:

  1. Mark all properties, except product_description to be skipped.
    this will generate a default vector, with only the product_description content

  2. Create a named vector, and tie it to the property you want to be the source of content for your vector.

Let me know if this helps :slight_smile: