1. Matt Chaput
  2. whoosh

Commits

Matt Chaput  committed 38cf3bb

Cleaning up and expanding documentation.

  • Participants
  • Parent commits c156870
  • Branches default

Comments (0)

Files changed (16)

File docs/source/api/analysis.rst

View file
 .. autoclass:: SpaceSeparatedTokenizer
 .. autoclass:: CommaSeparatedTokenizer
 .. autoclass:: NgramTokenizer
+.. autoclass:: PathTokenizer
 
 
 Filters
 .. autoclass:: PassFilter
 .. autoclass:: LoggingFilter
 .. autoclass:: MultiFilter
+.. autoclass:: ReverseTextFilter
 .. autoclass:: LowercaseFilter
 .. autoclass:: StripFilter
 .. autoclass:: StopFilter

File docs/source/api/formats.rst

View file
 
 .. autoclass:: Existence
 .. autoclass:: Frequency
-.. autoclass:: DocBoosts
 .. autoclass:: Positions
 .. autoclass:: Characters
 .. autoclass:: PositionBoosts

File docs/source/api/matching.rst

View file
 .. autoclass:: ListMatcher
 .. autoclass:: WrappingMatcher
 .. autoclass:: MultiMatcher
-.. autoclass:: ExcludeMatcher
+.. autoclass:: FilterMatcher
 .. autoclass:: BiMatcher
 .. autoclass:: AdditiveBiMatcher
 .. autoclass:: UnionMatcher
 .. autoclass:: InverseMatcher
 .. autoclass:: RequireMatcher
 .. autoclass:: AndMaybeMatcher
+.. autoclass:: ConstantScoreMatcher
 
 
 Exceptions

File docs/source/api/qparser.rst

View file
 Plug-ins
 ========
 
+.. autoclass:: Plugin
+    :members:
+
+.. autoclass:: SingleQuotePlugin
+.. autoclass:: PrefixPlugin
+.. autoclass:: WildcardPlugin
+.. autoclass:: BoostPlugin
+.. autoclass:: GroupPlugin
+.. autoclass:: EveryPlugin
 .. autoclass:: FieldsPlugin
-.. autoclass:: CompoundsPlugin
-.. autoclass:: NotPlugin
-.. autoclass:: WildcardPlugin
-.. autoclass:: PrefixPlugin
 .. autoclass:: PhrasePlugin
 .. autoclass:: RangePlugin
-.. autoclass:: SingleQuotesPlugin
-.. autoclass:: GroupPlugin
-.. autoclass:: BoostPlugin
-.. autoclass:: NotPlugin
+.. autoclass:: OperatorsPlugin
 .. autoclass:: PlusMinusPlugin
+.. autoclass:: GtLtPlugin
 .. autoclass:: MultifieldPlugin
-.. autoclass:: DisMaxPlugin
 .. autoclass:: FieldAliasPlugin
 .. autoclass:: CopyFieldPlugin
-.. autoclass:: GtLtPlugin
 
 
-Syntax objects
-==============
+Syntax node objects
+===================
 
-Groups
-------
+Base nodes
+----------
 
-.. autoclass:: SyntaxObject
-.. autoclass:: Group
+.. autoclass:: SyntaxNode
+    :members:
+
+
+Nodes
+-----
+
+.. autoclass:: FieldnameNode
+.. autoclass:: TextNode
+.. autoclass:: WordNode
+.. autoclass:: RangeNode
+.. autoclass:: MarkerNode
+
+
+Group nodes
+-----------
+
+.. autoclass:: GroupNode
+.. autoclass:: BinaryGroup
+.. autoclass:: ErrorNode
 .. autoclass:: AndGroup
 .. autoclass:: OrGroup
 .. autoclass:: AndNotGroup
 .. autoclass:: AndMaybeGroup
 .. autoclass:: DisMaxGroup
+.. autoclass:: RequireGroup
 .. autoclass:: NotGroup
 
 
-Tokens
-------
+Operators
+---------
 
-.. autoclass:: Token
-.. autoclass:: Singleton
-.. autoclass:: White
-.. autoclass:: BasicSyntax
-.. autoclass:: Word
+.. autoclass:: Operator
+.. autoclass:: PrefixOperator
+.. autoclass:: PostfixOperator
+.. autoclass:: InfixOperator
 
-    
 
+
+
+
+
+

File docs/source/api/query.rst

View file
 
 .. autoclass:: CompoundQuery
 .. autoclass:: MultiTerm
+.. autoclass:: ExpandingTerm
 .. autoclass:: WrappingQuery
 
 
 ===============
 
 .. autoclass:: ConstantScoreQuery
-.. autoclass:: WeightingQuery
 
 
 Exceptions

File docs/source/api/searching.rst

View file
 .. autoclass:: Collector
     :members:
     
-.. autoclass:: TermTrackingCollector
-
 
 Results classes
 ===============

File docs/source/api/sorting.rst

View file
 .. automodule:: whoosh.sorting
 
 
-Sorter object
+Base types
+==========
+
+.. autoclass:: FacetType
+    :members:
+
+.. autoclass:: Categorizer
+    :members:
+
+
+Facet types
+===========
+
+.. autoclass:: FieldFacet
+.. autoclass:: QueryFacet
+.. autoclass:: RangeFacet
+.. autoclass:: DateRangeFacet
+.. autoclass:: ScoreFacet
+.. autoclass:: FunctionFacet
+.. autoclass:: MultiFacet
+
+
+Facets object
 =============
 
-.. autoclass:: Sorter
+.. autoclass:: Facets
     :members:
 
-
-

File docs/source/api/spelling.rst

View file
 .. automodule:: whoosh.spelling
 
 
+Corrector objects
+=================
+
+.. autoclass:: Corrector
+    :members:
+
+.. autoclass:: ReaderCorrector
+
+.. autoclass:: GraphCorrector
+    :members:
+
+.. autoclass:: MultiCorrector
+
+
+QueryCorrector objects
+======================
+
+.. autoclass:: QueryCorrector
+    :members:
+
+.. autoclass:: SimpleQueryCorrector
+
+.. autoclass:: Correction
+
+

File docs/source/api/support/dawg.rst

View file
+=======================
+``support.dawg`` module
+=======================
+
+.. automodule:: whoosh.support.dawg
+
+
+Graph nodes
+===========
+
+.. autoclass:: BaseNode
+    :members:
+
+.. autoclass:: UnionNode
+.. autoclass:: IntersectionNode
+
+
+Utility functions
+=================
+
+.. autofunction:: edge_count
+.. autofunction:: flatten
+.. autofunction:: dump_dawg
+.. autofunction:: within
+

File docs/source/index.rst

View file
     fieldcaches
     batch
     threads
+    recipes
     api/api
     tech/index
 

File docs/source/recipes.rst

View file
+==============
+Whoosh recipes
+==============
+
+Shortcuts
+=========
+
+Look up documents by a field value
+----------------------------------
+::
+
+    # Single document (unique field value)
+    stored_fields = searcher.document(id="bacon")
+    
+    # Multiple documents
+    for stored_fields in searcher.documents(tag="cake"):
+        ...
+
+
+Queries
+=======
+
+
+
+Results
+=======
+
+How many hits were there?
+-------------------------
+
+The number of *scored* hits::
+
+    found = results.scored_length()
+
+Depending on the arguments to the search, the exact total number of hits may be
+known::
+
+    if results.has_exact_length():
+        print("Scored", found, "of exactly", len(results), "documents")
+
+Usually, however, the exact number of documents that match the query is not
+known, because the searcher can skip over blocks of documents it knows won't
+show up in the "top N" list. If you call ``len(results)`` on a query where the
+exact length is unknown, Whoosh will run an unscored version of the original
+query to get the exact number. This is faster than the scored search, but may
+still be noticeably slow on very large indexes or complex queries.
+
+As an alternative, you might display the *estimated* total hits::
+
+    if results.has_exact_length():
+        print("Scored", found, "of exactly", len(results), "documents")
+    else:
+        low = results.estimated_min_length()
+        high = results.estimated_length()
+    
+        print("Scored", found, "of between", low, "and", "high", "documents")
+
+
+Which terms matched in each hit?
+--------------------------------
+::
+
+    # Use terms=True to record term matches for each hit
+    results = searcher.search(myquery, terms=True)
+
+    for hit in results:
+        # Which terms matched in this hit?
+        print("Matched:", hit.matched_terms())
+        
+        # Which terms from the query didn't match in this hit?
+        print("Didn't match:", myquery.all_terms() - hit.matched_terms())
+
+
+Global information
+==================
+
+What fields are in the index?
+-----------------------------
+::
+
+    return myindex.schema.names()
+
+Is term X in the index?
+-----------------------
+::
+
+    return ("content", "wobble") in searcher
+    
+Is term X in document Y?
+------------------------
+::
+
+    # Check if the "content" field of document 500 contains the term "wobble"
+
+    # Without term vectors, skipping through list...
+    postings = searcher.postings("content", "wobble")
+    postings.skip_to(500)
+    return postings.id() == 500
+    
+    # ...or the slower but easier way
+    docset = set(searcher.postings("content", "wobble").all_ids())
+    return 500 in docset
+
+    # If field has term vectors, skipping through list...
+    vector = searcher.vector(500, "content")
+    vector.skip_to("wobble")
+    return vector.id() == "wobble"
+    
+    # ...or the slower but easier way
+    wordset = set(searcher.vector(500, "content").all_ids())
+    return "wobble" in wordset
+    
+    

File docs/source/releases/2_0.rst

View file
+========================
+Whoosh 2.x release notes
+========================
+
+Whoosh 2.0
+==========
+
+
+

File docs/source/releases/index.rst

View file
 .. toctree::
     :maxdepth: 2
     
+    2_0
     1_0
     0_3
     

File src/whoosh/searching.py

View file
         :param limit: the maximum number of documents to score. If you're only
             interested in the top N documents, you can set limit=N to limit the
             scoring for a faster search.
-        :param sortedby: see :doc`/facets`.
+        :param sortedby: see :doc:`/facets`.
         :param reverse: Reverses the direction of the sort.
-        :param groupedby: see :doc`/facets`.
+        :param groupedby: see :doc:`/facets`.
         :param optimize: use optimizations to get faster results when possible.
         :param filter: a query, Results object, or set of docnums. The results
             will only contain documents that are also in the filter object.
     def correct_query(self, q, qstring, correctors=None, allfields=False,
                       terms=None, prefix=0, maxdist=2):
         """Returns a corrected version of the given user query using a default
-        :class:`
+        :class:`whoosh.spelling.ReaderCorrector`.
         
-        The default 
+        The default:
         
         * Corrects any words that don't appear in the index.
         

File src/whoosh/spelling.py

View file
         :param q: the original :class:`whoosh.query.Query` tree to be
             corrected.
         :param qstring: the original user query. This may be None if the
-        original query string is not available, in which case the
-        ``Correction.string`` attribute will also be None.
+            original query string is not available, in which case the
+            ``Correction.string`` attribute will also be None.
         :rtype: :class:`Correction`
         """
         

File src/whoosh/writing.py

View file
         Instead of a single object (i.e., unicode string, number, or datetime),
         you can supply a list or tuple of objects. For unicode strings, this
         bypasses the field's analyzer. For numbers and dates, this lets you add
-        multiple values for the given field.
+        multiple values for the given field::
         
             date1 = datetime.now()
             date2 = datetime(2005, 12, 25)