Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advanced python string search

Tags:

python

search

I was wondering if anyone can point me to a library that can search a string using google-ish syntax. Examples:

Google advanced search syntax

Craigslist advanced search syntax

So if the query were

food -pizza

and the search subject was

Ray's Pizza, best food in town!

It would not result in a match. Etc etc.

like image 991
Mike Avatar asked Aug 22 '11 05:08

Mike


People also ask

How do you search a text string in Python?

String find() in Python The find(query) method is built-in to standard python. Just call the method on the string object to search for a string, like so: obj. find(“search”). The find() method searches for a query string and returns the character position if found.

Is find () a string method?

Introduction to Python string find() method The find() is a string method that finds a substring in a string and returns the index of the substring.

What is the Python Find () method used for?

The find() method finds the first occurrence of the specified value. The find() method returns -1 if the value is not found.


1 Answers

Whoosh is really great fast, full-text search engine written in Python, it has a nice API and nice documentation.

like image 159
zeekay Avatar answered Oct 01 '22 16:10

zeekay