Skip to content

Commit

Permalink
fixing comments by code review
Browse files Browse the repository at this point in the history
  • Loading branch information
andreluiz1987 committed Oct 22, 2024
1 parent fb99c98 commit b3ff9ba
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This project consists of two main components: a front-end application and an API

### API

- Developed with python
- Developed with Python
- Provides endpoints for fetching product data and handling search/filter requests.
- Implements hybrid search combining lexical and semantic search techniques.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ semantic search techniques, offering more accurate and relevant results.
2. Navigate to the project directory:
```bash
cd repository-name
3. Install dependencies:
```bash
npm install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const ProductCard = ({ product, searchTerm, products }) => {
const defaultImage = "https://via.placeholder.com/100";

const handleClick = () => {
//alert(`Produto: ${product.name} - Termo de pesquisa: ${searchTerm}`);

trackSearchClick({
document: { id: product.id, index: "products-catalog"},
Expand Down Expand Up @@ -179,7 +178,7 @@ const ProductPage = () => {
query: searchTerm,
selectedCategories: selectedFacets.categories,
selectedProductTypes: selectedFacets.productTypes,
selectedbrands: selectedFacets.brands,
selectedBrands: selectedFacets.brands,
hybrid: isHybridSearch
}
});
Expand Down Expand Up @@ -212,7 +211,7 @@ const ProductPage = () => {
query: searchTerm,
selectedCategories: selectedFacets.categories,
selectedProductTypes: selectedFacets.productTypes,
selectedbrands: selectedFacets.brands,
selectedBrands: selectedFacets.brands,
hybrid: isHybridSearch
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ applying filters to refine the results according to specific criteria.

---

## Referências
## References

- [Documentação do Docker](https://docs.docker.com/)
- [Documentação do Docker Compose](https://docs.docker.com/compose/)
- [Docker Documentation](https://docs.docker.com/)
- [Docker Compose Documentation](https://docs.docker.com/compose/)

Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def build_query(term=None, categories=None, product_types=None, brands=None):


def build_hybrid_query(term=None, categories=None, product_types=None, brands=None, hybrid=False):
# Query padrão
# Standard query
organic_query = build_query(term, categories, product_types, brands)

if hybrid is True and term:

vector = get_text_vector([term])[0]

# Query híbrida com RRF (Reciprocal Rank Fusion)
# Hybrid query with RRF (Reciprocal Rank Fusion)
query = {
"retriever": {
"rrf": {
Expand Down Expand Up @@ -174,7 +174,7 @@ def search():
query = request.args.get('query')
categories = request.args.getlist('selectedCategories[]')
product_types = request.args.getlist('selectedProductTypes[]')
brands = request.args.getlist('selectedbrands[]')
brands = request.args.getlist('selectedBrands[]')
hybrid = request.args.get('hybrid', 'False').lower() == 'true'
results = search_products(query, categories=categories, product_types=product_types,
brands=brands,
Expand All @@ -188,7 +188,7 @@ def facets():
query = request.args.get('query')
categories = request.args.getlist('selectedCategories[]')
product_types = request.args.getlist('selectedProductTypes[]')
brands = request.args.getlist('selectedbrands[]')
brands = request.args.getlist('selectedBrands[]')
results = get_facets_data(query, categories=categories,
product_types=product_types,
brands=brands)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ def index_data_in_batches(file_path, index_name, batch_size=100):


if __name__ == '__main__':
# print(get_client_es().info())
index_data_in_batches("../files/dataset/products.json", "products-catalog", batch_size=100)

0 comments on commit b3ff9ba

Please sign in to comment.