I have a couple of models in a simple django app :
class Product(models.Model):
type = models.CharField(
max_length=10,
choices=TypeOfComputer.choices,
)
title = models.CharField(max_length=250)
description = models.TextField()
year = models.CharField(max_length=4)
color = models.CharField(max_length=10)
storage = models.CharField(max_length=10)
ram = models.CharField(max_length=10, blank=True)
screen = models.CharField(max_length=10)
image = models.ImageField(upload_to='product/images/', blank=True)
created = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=True)
slug = models.SlugField(null=False, blank=False)
user = models.ForeignKey(User, on_delete=models.CASCADE)
class Reseller(models.Model):
name = models.CharField(max_length=250)
url = models.URLField(max_length=250)
email = models.EmailField(max_length=250, blank=True, default='')
phone = models.CharField(max_length=50, blank=True, default='')
logo = models.ImageField(upload_to='reseller/', blank=True)
active = models.BooleanField(default=True)
slug = models.SlugField(null=False, blank=False)
class Item(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE)
reseller = models.ForeignKey(Reseller, on_delete=models.CASCADE)
price = models.PositiveIntegerField(default=0)
offers = models.TextField(null=True, blank=True)
url = models.URLField(max_length=500, blank=True)
last_updated = models.DateTimeField()
active = models.BooleanField(default=True)
If I wanted to create a search box on the page to search for only rows’ values in these 3 tables, then what would be the best approach to design this ?
Manually write code for searching these tables alone ?
Or is there some library out there that does this specifically upon giving some input fields for search etc (and also with weights given to each field) ?
PS: I don’t think elastic search or meilisearch would be appropriate for this as the data itself is under 1000 rows combined. It’ll grow to max 10,000