Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Just a few updates to the query box
Browse files Browse the repository at this point in the history
  • Loading branch information
chouinar committed May 16, 2024
1 parent f3f4526 commit db51054
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion api/src/adapters/opensearch/populate_search_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def insert(opensearch_client: OpenSearch, db_session: db.Session) -> None:
continue

body = OpportunitySchema().dump(opp)
print(body)

# TODO - use the bulk endpoint instead
# however that requires making raw JSON text - which I'll do later
Expand Down
9 changes: 4 additions & 5 deletions api/src/services/opportunities_v0_1/search_opportunities.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@ def opensearch_approach(search_params: SearchOpportunityParams) -> Tuple[Sequenc

if search_params.query:
must_filters.append({
"multi_match": {
"simple_query_string": {
"query": search_params.query,
"fields": ["agency^16", "opportunity_title^2", "opportunity_number^12", "summary.summary_description", "opportunity_assistance_listings.assistance_listing_number^10", "opportunity_assistance_listings.program_title^4"],
"type": "best_fields",
"tie_breaker": 0.3
"default_operator": "AND",
"fields": ["agency.keyword^16", "opportunity_title^2", "opportunity_number^12", "summary.summary_description", "opportunity_assistance_listings.assistance_listing_number^10", "opportunity_assistance_listings.program_title^4"],
}
}
)
Expand Down Expand Up @@ -254,8 +253,8 @@ def opensearch_approach(search_params: SearchOpportunityParams) -> Tuple[Sequenc
if non_scoring_filters:
body["query"]["bool"]["filter"] = non_scoring_filters

print(body)
result = client.search(body=body, index="test-opportunity-index")
print(result)

raw_opps = [opp for opp in result["hits"]["hits"]]

Expand Down

0 comments on commit db51054

Please sign in to comment.