示例#1
0
def search(term):
    startTiming()

    searcher = IndexSearcher(g_indexPath)
    # Note that all queries have to be submitted in lower-case...
    q = termSearch(term)
    runQuery(q, searcher)
    
    #q = phraseSearch('fox and the crow')
    #runQuery(q, searcher)

    # A boolean search equiv to 'x and not y'
    #q = boolSearch(['fox'], [], ['crow', 'lion'])
    #runQuery(q, searcher)

    # Search the title field
    #q = titleSearch('frog')
    #runQuery(q, searcher)

    searcher.close()

    endTiming()
    dumpTiming()
示例#2
0
def search(term):
    startTiming()

    searcher = IndexSearcher(g_indexPath)
    # Note that all queries have to be submitted in lower-case...
    q = termSearch(term)
    runQuery(q, searcher)

    #q = phraseSearch('fox and the crow')
    #runQuery(q, searcher)

    # A boolean search equiv to 'x and not y'
    #q = boolSearch(['fox'], [], ['crow', 'lion'])
    #runQuery(q, searcher)

    # Search the title field
    #q = titleSearch('frog')
    #runQuery(q, searcher)

    searcher.close()

    endTiming()
    dumpTiming()
示例#3
0
    hits = searcher.search(q)
    printHits(hits)
    print
    return hits

       
      
if __name__ == "__main__":
    """One shot search.
    Opens and closes the index on every query.
    """
    
    import time    
    tt = time.time()
    
    searcher = IndexSearcher('aesopind')

    # Note that all queries have to be submitted in lower-case...

    q = termSearch('fox')
    runQuery(q, searcher)
    
    q = phraseSearch('fox and the crow')
    runQuery(q, searcher)

    # A boolean search equiv to 'x and not y'
    q = boolSearch(['fox'], [], ['crow', 'lion'])
    runQuery(q, searcher)

    # Search the title field
    q = titleSearch('frog')
示例#4
0
def _search(query):
    searcher = IndexSearcher(_g_index_path)
    docs = searcher.search(query)
    return docs