Skip to content

Commit

Permalink
update sample to show facet+count & collection type (#13909)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyan99 authored Sep 24, 2020
1 parent 8bca406 commit b9cc959
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def filter_query():
search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key))

async with search_client:
results = await search_client.search(search_text="WiFi", facets=["Category"], top=0)
results = await search_client.search(search_text="WiFi", facets=["Category,count:3", "ParkingIncluded"])

facets = await results.get_facets()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ async def create_index():
fields = [
SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True),
SimpleField(name="baseRate", type=SearchFieldDataType.Double),
SearchableField(name="description", type=SearchFieldDataType.String),
SearchableField(name="description", type=SearchFieldDataType.String, collection=True),
ComplexField(name="address", fields=[
SimpleField(name="streetAddress", type=SearchFieldDataType.String),
SimpleField(name="city", type=SearchFieldDataType.String),
])
], collection=True)
]

cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60)
Expand All @@ -72,16 +72,16 @@ async def get_index():
async def update_index():
# [START update_index_async]
name = "hotels"
fields = fields = [
fields = [
SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True),
SimpleField(name="baseRate", type=SearchFieldDataType.Double),
SearchableField(name="description", type=SearchFieldDataType.String),
SearchableField(name="description", type=SearchFieldDataType.String, collection=True),
SearchableField(name="hotelName", type=SearchFieldDataType.String),
ComplexField(name="address", fields=[
SimpleField(name="streetAddress", type=SearchFieldDataType.String),
SimpleField(name="city", type=SearchFieldDataType.String),
SimpleField(name="state", type=SearchFieldDataType.String),
])
], collection=True)
]

cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def filter_query():

search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key))

results = search_client.search(search_text="WiFi", facets=["Category"], top=0)
results = search_client.search(search_text="WiFi", facets=["Category,count:3", "ParkingIncluded"])

facets = results.get_facets()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def create_index():
fields = [
SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True),
SimpleField(name="baseRate", type=SearchFieldDataType.Double),
SearchableField(name="description", type=SearchFieldDataType.String),
SearchableField(name="description", type=SearchFieldDataType.String, collection=True),
ComplexField(name="address", fields=[
SimpleField(name="streetAddress", type=SearchFieldDataType.String),
SimpleField(name="city", type=SearchFieldDataType.String),
])
], collection=True)
]
cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60)
scoring_profiles = []
Expand All @@ -73,13 +73,13 @@ def update_index():
fields = [
SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True),
SimpleField(name="baseRate", type=SearchFieldDataType.Double),
SearchableField(name="description", type=SearchFieldDataType.String),
SearchableField(name="description", type=SearchFieldDataType.String, collection=True),
SearchableField(name="hotelName", type=SearchFieldDataType.String),
ComplexField(name="address", fields=[
SimpleField(name="streetAddress", type=SearchFieldDataType.String),
SimpleField(name="city", type=SearchFieldDataType.String),
SimpleField(name="state", type=SearchFieldDataType.String),
])
], collection=True)
]
cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60)
scoring_profile = ScoringProfile(
Expand Down

0 comments on commit b9cc959

Please sign in to comment.