text_search_stage#

langchain_mongodb.pipelines.text_search_stage(query: str, search_field: str, index_name: str, limit: int | None = None, filter: Dict[str, Any] | None = None, include_scores: bool | None = True, **kwargs: Any) β†’ List[Dict[str, Any]][source]#

Full-Text search using Lucene’s standard (BM25) analyzer

Parameters:
  • query (str) – Input text to search for

  • search_field (str) – Field in Collection that will be searched

  • index_name (str) – Atlas Search Index name

  • limit (int | None) – Maximum number of documents to return. Default of no limit

  • filter (Dict[str, Any] | None) – Any MQL match expression comparing an indexed field

  • include_scores (bool | None) – Scores provide measure of relative relevance

  • kwargs (Any)

Returns:

Dictionary defining the $search stage

Return type:

List[Dict[str, Any]]