Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

115 refactor search and enhance api #116

Merged
merged 18 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/monggregate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from monggregate.dollar import S, SS
from monggregate.pipeline import Pipeline

__all__ = ["Expression", "S", "SS", "Pipeline"]

__version__ = "0.21.0"
__author__ = "Vianney Mixtur"
__contact__ = "[email protected]"
__copyright__ = "Copyright © 2022 Vianney Mixtur"
__copyright__ = "Copyright © 2022-2024 Vianney Mixtur"
__license__ = "MIT"
4 changes: 1 addition & 3 deletions src/monggregate/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from monggregate.base import BaseModel
from monggregate.stages import (
AnyStage,
Stage,
BucketAuto,
GranularityEnum,
Bucket,
Expand All @@ -35,17 +34,16 @@
Unset,
VectorSearch,
)
from monggregate.stages.search.base import SearchBase, OperatorLiteral
from monggregate.stages.search.base import OperatorLiteral
from monggregate.search.operators import OperatorMap
from monggregate.search.operators.compound import Compound, ClauseType
from monggregate.search.collectors.facet import Facet, FacetType
from monggregate.search.commons import CountOptions, HighlightOptions
from monggregate.operators import MergeObjects
from monggregate.dollar import ROOT
from monggregate.utils import StrEnum



Check warning on line 46 in src/monggregate/pipeline.py

View workflow job for this annotation

GitHub Actions / lint-and-format-backend

[black-format] reported by reviewdog 🐶 Raw Output: /home/runner/work/monggregate/monggregate/src/monggregate/pipeline.py:46:- /home/runner/work/monggregate/monggregate/src/monggregate/pipeline.py:47:-class Pipeline(BaseModel): # pylint: disable=too-many-public-methods /home/runner/work/monggregate/monggregate/src/monggregate/pipeline.py:46:+class Pipeline(BaseModel): # pylint: disable=too-many-public-methods
class Pipeline(BaseModel): # pylint: disable=too-many-public-methods
"""
MongoDB aggregation pipeline abstraction
Expand Down
62 changes: 61 additions & 1 deletion src/monggregate/search/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
"""Search Package"""
"""Search Package"""

from monggregate.search.commons import (
FuzzyOptions,
CountOptions,
HighlightOptions,
HightlightOutput,
CountResults,
)
from monggregate.search.collectors import (
Facet,
Facets,
FacetBucket,
FacetBuckets,
FacetResult,
StringFacet,
NumericFacet,
DateFacet,
FacetName,
)
from monggregate.search.operators import (
Autocomplete,
Compound,
Equals,
Exists,
MoreLikeThis,
Range,
Regex,
Text,
Wildcard,
AnyOperator,
OperatorMap,
)

__all__ = [
"FuzzyOptions",
"CountOptions",
"HighlightOptions",
"HightlightOutput",
"CountResults",
"Facet",
"Facets",
"FacetBucket",
"FacetBuckets",
"FacetResult",
"StringFacet",
"NumericFacet",
"DateFacet",
"FacetName",
"Autocomplete",
"Compound",
"Equals",
"Exists",
"MoreLikeThis",
"Range",
"Regex",
"Text",
"Wildcard",
"AnyOperator",
"OperatorMap",
]
15 changes: 14 additions & 1 deletion src/monggregate/search/collectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,18 @@
DateFacet,
Facets,
# String
FacetName,
FacetName,
)


__all__ = [
"Facet",
"FacetBucket",
"FacetBuckets",
"FacetResult",
"StringFacet",
"NumericFacet",
"DateFacet",
"Facets",
"FacetName",
]
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions src/monggregate/search/commons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
from monggregate.search.commons.count import CountOptions, CountResults
from monggregate.search.commons.fuzzy import FuzzyOptions
from monggregate.search.commons.highlight import HighlightOptions, HightlightOutput

__all__ = ["CountOptions", "CountResults", "FuzzyOptions", "HighlightOptions", "HightlightOutput"]
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/monggregate/stages/search/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
from monggregate.base import pyd, BaseModel
from monggregate.stages.stage import Stage
from monggregate.search.collectors import Facet, Facets
from monggregate.search.collectors import Facet
from monggregate.search.operators import(
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
Autocomplete,
Compound,
Expand Down
22 changes: 2 additions & 20 deletions src/monggregate/stages/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,13 @@

"""

from datetime import datetime
from typing import Any, Callable, Literal
try:
from typing import Self
except ImportError:
from typing_extensions import Self

VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
from monggregate.base import pyd
from monggregate.stages.stage import Stage
from monggregate.stages.search.base import SearchConfig, SearchBase
from monggregate.search.collectors import Facet, Facets
from monggregate.search.operators import(
Autocomplete,
Compound,
Equals,
Exists,
MoreLikeThis,
Range,
Regex,
Text,
Wildcard,
AnyOperator
)
from monggregate.search.operators.compound import ClauseType
from monggregate.search.commons import FuzzyOptions
from monggregate.stages.search.base import SearchBase

VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved


VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
# Classes
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
VianneyMI marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion src/monggregate/stages/search/search_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

"""

from monggregate.stages.search.base import SearchConfig, SearchBase
from monggregate.stages.search.base import SearchBase


class SearchMeta(SearchBase):
Expand Down
Loading