Did I find the right examples for you? yes no

All Samples(10)  |  Call(6)  |  Derive(0)  |  Import(4)
Convenience function for opening an index in a directory based on
open_dir in whoosh.index.
This functions automatically detects if the machine is 32-bit or 64-bit,
and turns off mmap if only 32-bit to avoid address space exhaustion
on large indices.

:param dirname: the path string of the directory in which to create the
    index.
:param indexname: the name of the index to create; you only need to specify
    this if you have multiple indexes within the same storage object.

        def whoosh_open_dir_32_or_64(dirname, indexname=None, readonly=False):
    """Convenience function for opening an index in a directory based on
    open_dir in whoosh.index.
    This functions automatically detects if the machine is 32-bit or 64-bit,
    and turns off mmap if only 32-bit to avoid address space exhaustion
    on large indices.

    :param dirname: the path string of the directory in which to create the
        index.
    :param indexname: the name of the index to create; you only need to specify
        this if you have multiple indexes within the same storage object.
    """

    from whoosh.filedb.filestore import FileStorage
    from whoosh.index import _DEF_INDEX_NAME

    supports_mmap = not is32bit()
    if indexname is None:
        indexname = _DEF_INDEX_NAME

    storage = FileStorage(dirname, readonly=readonly, supports_mmap=supports_mmap)
    return storage.open_index(indexname)
        


src/i/n/Internet-in-a-Box-0.5.10/iiab/wikipedia_search.py   Internet-in-a-Box(Download)
# Internet-in-a-Box System
# By Braddock Gaskill, 16 Feb 2013
from whoosh.qparser import QueryParser
 
from utils import whoosh2dict, whoosh_open_dir_32_or_64
        """
        query = unicode(query)  # Must be unicode
        ix = whoosh_open_dir_32_or_64(self.index_dir)
        with ix.searcher() as searcher:
            query = QueryParser("title", ix.schema).parse(query)
    def count(self, query):
        """Return total number of matching documents in index"""
        query = unicode(query)  # Must be unicode
        ix = whoosh_open_dir_32_or_64(self.index_dir)
        with ix.searcher() as searcher:

src/i/n/Internet-in-a-Box-0.5.10/iiab/map_search.py   Internet-in-a-Box(Download)
# Internet-in-a-Box System
# By Braddock Gaskill, 16 Feb 2013
from utils import whoosh_open_dir_32_or_64
from whoosh.qparser import QueryParser
from whoosh import sorting
        query = unicode(query)  # Must be unicode
        population_sort_facet = sorting.FieldFacet("population", reverse=True)
        ix = whoosh_open_dir_32_or_64(self.index_dir)
        with ix.searcher() as searcher:
            query = QueryParser("ngram_name", ix.schema).parse(query)
    def count(self, query):
        """Return total number of matching documents in index"""
        query = unicode(query)  # Must be unicode
        ix = whoosh_open_dir_32_or_64(self.index_dir)
        with ix.searcher() as searcher:

src/i/n/Internet-in-a-Box-0.5.10/iiab/zim_views.py   Internet-in-a-Box(Download)
 
from whoosh_search import paginated_search
from utils import whoosh_open_dir_32_or_64
 
from .endpoint_description import EndPointDescription
 
        # Load index so we can query it for which fields exist
        ix = whoosh_open_dir_32_or_64(index_dir)
 
        # Set a higher value for the title field so it is weighted more

src/i/n/Internet-in-a-Box-0.5.10/iiab/gutenberg.py   Internet-in-a-Box(Download)
from whoosh_search import paginated_search
from whoosh.index import open_dir
from utils import whoosh_open_dir_32_or_64
 
from .endpoint_description import EndPointDescription
        index_dir = config().get_path('GUTENBERG', 'index_dir')
        page = int(request.args.get('page', 1))
        ix = whoosh_open_dir_32_or_64(index_dir)
        (pagination, suggestion) = paginated_search(ix, DEFAULT_SEARCH_COLUMNS, query, page, sort_column='creator')
    else: