You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by Aditi Goyal <ad...@gmail.com> on 2008/02/12 12:40:24 UTC

Indexing the fields

Hi ,
I am using PyLucene in my program. I want to search for all the words with
the "sim" in it. So, I typed "sim*" in my query. It is also giving me
results which doesnt have word "sim" in it. But those have "si" in it.
Am I doing something wrong. Please advice.

Following is the code which I used for searching:
        directory = PyLucene.FSDirectory.getDirectory(index_dir, False)
        searcher = PyLucene.IndexSearcher(directory)
        analyzer = PyLucene.StandardAnalyzer()

        simple_query = ['Mailbody' , 'Subject', 'From', 'To', 'Cc', 'Bcc',
'pdf','doc','msword','html','plain']
        parser = PyLucene.MultiFieldQueryParser(simple_query, analyzer )
        parser.setDefaultOperator(PyLucene.QueryParser.Operator.AND)
        query = parser.parse(command)
        hits = searcher.search(query)


Also, is there any way by which I can set the search as partial search by
default.
Thanks in advance.

Regards,
Aditi