Skip to content

Commit

Permalink
Add examples for SolrFacetSetResult in python
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh1nku committed Dec 10, 2024
1 parent c5481c0 commit 4db2eb7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion wrappers/python/solrstice/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ class SelectQuery:
"""

class CommitType(Enum):
Hard = ("Hard",)
Hard = "Hard"
Soft = "Soft"

class UpdateQuery:
Expand Down
31 changes: 31 additions & 0 deletions wrappers/python/solrstice/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ class SolrFacetSetResult:
Gets the query facets
:return: The query facets
>>> from solrstice import AsyncSolrCloudClient, SolrServerContext, SelectQuery, FacetSetComponent, FacetSetComponent
>>> client = AsyncSolrCloudClient(SolrServerContext('localhost:8983'))
>>> async def query_select() -> None:
... select_builder = SelectQuery(facet_set=FacetSetComponent(queries=["age:[0 TO 59]"]))
... response = await client.select(select_builder, "example_collection")
... facets = response.get_facet_set()
... queries = facets.get_queries()
... query = queries.get("age:[0 TO 59]")
"""
pass

Expand All @@ -18,6 +28,16 @@ class SolrFacetSetResult:
Gets the pivot facets
:return: The pivot facets
>>> from solrstice import FacetSetComponent, PivotFacetComponent, SelectQuery, SolrServerContext, AsyncSolrCloudClient
>>> client = AsyncSolrCloudClient(SolrServerContext('localhost:8983'))
>>> async def pivot_select() -> None:
... select_builder = SelectQuery(facet_set=FacetSetComponent(pivots=PivotFacetComponent(["interests,age"])))
... response = await client.select(select_builder, "example_collection")
... facets = response.get_facet_set()
... pivots = facets.get_pivots()
... interests_age = pivots.get("interests,age")
"""
pass

Expand All @@ -26,6 +46,17 @@ class SolrFacetSetResult:
Gets the field facets
:return: The field facets
>>> from solrstice import FacetSetComponent, FieldFacetComponent, FieldFacetEntry, SelectQuery, SolrServerContext, AsyncSolrCloudClient
>>> client = AsyncSolrCloudClient(SolrServerContext('localhost:8983'))
>>> async def field_facet_select() -> None:
... facet_set = FacetSetComponent(fields=FieldFacetComponent(fields=[FieldFacetEntry("age")]))
... select_builder = SelectQuery(facet_set=facet_set)
... response = await client.select(select_builder, "example_collection")
... facets = response.get_facet_set()
... fields = facets.get_fields()
... age = fields.get("age")
"""

class SolrPivotFacetResult:
Expand Down

0 comments on commit 4db2eb7

Please sign in to comment.