Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • Compute Services
  • System Modeler
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

Wolfram Consulting

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Notebook Assistant + LLM Kit
    • Compute Services
    • System Modeler
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
TextSearch
  • See Also
    • TextSearchReport
    • SearchIndexObject
    • ContentObject
    • CreateSearchIndex
    • SearchResultObject
    • SearchIndices
    • FindList
    • StringCases
    • FindTextualAnswer
    • MailSearch
  • Related Guides
    • Text Search
    • Natural Language Processing
    • See Also
      • TextSearchReport
      • SearchIndexObject
      • ContentObject
      • CreateSearchIndex
      • SearchResultObject
      • SearchIndices
      • FindList
      • StringCases
      • FindTextualAnswer
      • MailSearch
    • Related Guides
      • Text Search
      • Natural Language Processing

TextSearch[source,form]

searches for files referenced by source that contain text matching form.

TextSearch[source,form,"prop"]

returns the property prop for each result.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Options  
ContentFieldOptions  
DocumentWeightingRules  
MaxItems  
Properties & Relations  
Possible Issues  
See Also
Related Guides
Related Links
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • TextSearchReport
    • SearchIndexObject
    • ContentObject
    • CreateSearchIndex
    • SearchResultObject
    • SearchIndices
    • FindList
    • StringCases
    • FindTextualAnswer
    • MailSearch
  • Related Guides
    • Text Search
    • Natural Language Processing
    • See Also
      • TextSearchReport
      • SearchIndexObject
      • ContentObject
      • CreateSearchIndex
      • SearchResultObject
      • SearchIndices
      • FindList
      • StringCases
      • FindTextualAnswer
      • MailSearch
    • Related Guides
      • Text Search
      • Natural Language Processing

TextSearch

TextSearch[source,form]

searches for files referenced by source that contain text matching form.

TextSearch[source,form,"prop"]

returns the property prop for each result.

Details and Options

  • TextSearch supports the following basic search forms, which can be combined arbitrarily:
  • "string"complete string must occur in the document
    {s1,s2,…}all si must occur in the document
    s1|s2|…at least one of the si must occur in the document
    "field"s1the si must occur in the given field
    FixedOrder[s1,s2,…]the si must occur in the order given
    Except[q]q cannot occur in the document
    SearchAdjustment[q,…]q occurs and is assigned a certain weight etc.
    Between[…],LessThan[…],…numbers etc. in particular ranges etc. occur
    SearchQueryString["query"]complete search-engine-style query
    Allall indexed documents are returned
  • TextSearch also supports the alternative forms ContainsAll[…], ContainsAny[…] and ContainsNone[…], as well as And[…], Or[…] and Not[…].
  • TextSearch allows the following to be used as sources:
  • "path" or File["path"]individual file or directory of files
    "name"SearchIndexObject["name"]
    SearchIndexObject[…]search index generated by CreateSearchIndex
    {obj1,obj2,…}list of objects
  • TextSearch[source,form] returns a SearchResultObject[…] expression.
  • The properties prop can be any of the properties for ContentObject, in which case TextSearch[source,form,prop] is equivalent to SearchResultObject[…][All,prop].
  • The following additional properties are supported in TextSearch[source,form,prop]:
  • "Count"total number of search results
    "ContentObject"search results as content objects in a list
    "Association"search results in an association
  • The property "Score" defines the default order in which search results are sorted.
  • Possible options include:
  • ContentFieldOptions <||>weighting options for fields
    DocumentWeightingRules Noneweighting of documents based on the values of certain fields
    MaxItems Allthe number of items to return
  • Files with an extension typical of binary files as well as files that contain non-textual byte values will not be indexed or searched.
  • TextSearch supports many file formats that can be imported as plain text. Some of these include: "TXT", "CSV", "JSON", "XML", "PDF", "NB", "EPS".
  • TextSearch does not support most image, audio and other kinds of file formats that do not have a text component.
  • TextSearch reads the "Plaintext" element of a file, which is given by Import[file, "Plaintext"].

Examples

open all close all

Basic Examples  (3)

Create an index over a specific directory:

Search for files in the specified directory that contain the word "dog" using the index:

Search for files containing "man" but not "animal" using advanced query syntax and show a contextual snippet:

TextSearch can also query a directory without indexing it:

Search for files containing both words:

Search for files containing either word:

Queries can be combined:

Scope  (1)

Create an index using example text:

Add a second index:

Search in both indices:

Options  (3)

ContentFieldOptions  (1)

Specify weights for the fields in the index at query time:

Set a weight of 2 for the "Keywords" field:

When no weight is set, "doc1" gets a higher score:

DocumentWeightingRules  (1)

Define a "ConfidenceLevel" field and use it for document weighting:

MaxItems  (1)

Get only the first result:

Properties & Relations  (1)

Queries are case insensitive:

Queries only match entire words:

Possible Issues  (2)

Only field weights can be specified at search time, while other content field options need to be specified at index creation time:

The following search returns a result because "IgnoreCase" is True by default, and "IgnoreCase" cannot be specified at search time:

When the same option is specified at index time, no result is returned:

The "Score" fields of objects matched in different indices are not comparable in general:

And indeed, in general a search on multiple indices returns results not sorted by "Score":

See Also

TextSearchReport  SearchIndexObject  ContentObject  CreateSearchIndex  SearchResultObject  SearchIndices  FindList  StringCases  FindTextualAnswer  MailSearch

Function Repository: ConcordanceWords

Related Guides

    ▪
  • Text Search
  • ▪
  • Natural Language Processing

Related Links

  • An Elementary Introduction to the Wolfram Language : String Patterns and Templates

History

Introduced in 2015 (10.2) | Updated in 2017 (11.1)

Wolfram Research (2015), TextSearch, Wolfram Language function, https://reference.wolfram.com/language/ref/TextSearch.html (updated 2017).

Text

Wolfram Research (2015), TextSearch, Wolfram Language function, https://reference.wolfram.com/language/ref/TextSearch.html (updated 2017).

CMS

Wolfram Language. 2015. "TextSearch." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/TextSearch.html.

APA

Wolfram Language. (2015). TextSearch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TextSearch.html

BibTeX

@misc{reference.wolfram_2025_textsearch, author="Wolfram Research", title="{TextSearch}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/TextSearch.html}", note=[Accessed: 01-February-2026]}

BibLaTeX

@online{reference.wolfram_2025_textsearch, organization={Wolfram Research}, title={TextSearch}, year={2017}, url={https://reference.wolfram.com/language/ref/TextSearch.html}, note=[Accessed: 01-February-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English