Lupyne’s documentation — Lupyne 1.6 documentation

### Navigation

- index
- modules |
- next |
- Lupyne 1.6 documentation »

# Lupyne’s documentation

Lupyne is:
  - a high-level Pythonic search engine library, built on PyLucene
  - a RESTful JSON search server, built on CherryPy
  - a simple Python client for interacting with the server

## Quickstart

    >>> from lupyne import engine                       # don't forget to call lucene.initVM
    >>> indexer = engine.Indexer()                      # create an in-memory index (no filename supplied)
    >>> indexer.set('name', stored=True)                # create stored 'name' field
    >>> indexer.set('text')                             # create indexed 'text' field (the default)
    >>> indexer.add(name='sample', text='hello world')  # add a document to the index
    >>> indexer.commit()                                # commit changes; document is now searchable
    >>> hits = indexer.search('text:hello')             # run search and return sequence of documents
    >>> len(hits), hits.count                           # 1 hit retrieved (out of a total of 1)
    (1, 1)
    >>> hit, = hits
    >>> hit['name']                                     # hits support mapping interface for their stored fields
    u'sample'
    >>> hit.id, hit.score                               # plus internal doc number and score
    (0, 0.19178301095962524)
    >>> hit.dict()                                      # dict representation of the hit document
    {'__score__': 0.19178301095962524, u'name': u'sample', '__id__': 0}

See more examples

## Contents

- engine
  - indexers
    - TokenStream
    - TokenFilter
    - Analyzer
    - IndexReader
    - IndexSearcher
    - MultiSearcher
    - IndexWriter
    - Indexer
    - ParallelIndexer
  - documents
    - Document
    - Hit
    - Hits
    - Groups
    - GroupingSearch
    - Field
    - MapField
    - NestedField
    - DocValuesField
    - NumericField
    - DateTimeField
  - queries
    - Query
    - BooleanQuery
    - SpanQuery
    - TermsFilter
    - SortField
    - Highlighter
    - FastVectorHighlighter
    - SpellChecker
    - SpellParser
  - spatial
    - Tiler
    - PointField
    - PolygonField
    - DistanceComparator
- server
  - tools
  - WebSearcher
  - WebIndexer
  - start
- client
  - Response
  - Resource
  - Pool
  - Resources
  - Shards
  - Replicas

# Indices and tables

- Index
- Module Index
- Search Page

### Navigation

- index
- modules |
- next |
- Lupyne 1.6 documentation »