Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

TextSearch

TextSearch[source,form]
searches for files referenced by source that contain text matching form.

DetailsDetails

  • 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 assigned a certain weight, etc.
    Between[],LessThan[],numbers etc. in particular ranges, etc. occur
    SearchQueryString["query"]complete search-engine-style query
  • 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:
  • "file" or File[]individual file
    "dir" or File[]directory of files
    SearchIndexObject[]search index generated by CreateSearchIndex
    {obj1,obj2,}list of objects
  • TextSearch returns a SearchResultObject[] expression.
  • Files with an extension typical of binary files as well as files that contain non-textual byte values will not be indexed or searched.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

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

In[1]:=
Click for copyable input
Out[1]=

Search for files containing both words:

In[1]:=
Click for copyable input
Out[1]=

Search for files containing either word:

In[2]:=
Click for copyable input
Out[2]=

Queries can be combined:

In[3]:=
Click for copyable input
Out[3]=
Introduced in 2015
(10.2)